none
Automatically inserting a template file in a new workbook (Excel) RRS feed

  • Question

  • I have created a template file which I would like to insert automatically when using the "new worksheet" tab.

    I understand I can right-click and Insert the template, but I was wondering whether there was a way you can set this up so that it inserts it automatically?  

    Thanks


    Wednesday, August 5, 2015 2:33 AM

Answers

  • Hi Michelle,

    Yes, we can add the sheets based on the template by specific type of Worksheets.Add method. Here is an examlpe for your reference:

     Sheets.Add Type:= _
            "C:\Program Files\Microsoft Office 15\Root\Templates\1033\BillingStatement.xltx"

    In addition, a good way to learn how to navigate the object models of Word, Excel, and Powerpoint, based on what you want to do as a user, is to use the Macro Recorder. Thouhg the recorded macro won't be the best possible code in most cases, but it's does very well for a quick example.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, August 6, 2015 6:45 AM
    Moderator

All replies

  • Hi Michelle,

    Yes, we can add the sheets based on the template by specific type of Worksheets.Add method. Here is an examlpe for your reference:

     Sheets.Add Type:= _
            "C:\Program Files\Microsoft Office 15\Root\Templates\1033\BillingStatement.xltx"

    In addition, a good way to learn how to navigate the object models of Word, Excel, and Powerpoint, based on what you want to do as a user, is to use the Macro Recorder. Thouhg the recorded macro won't be the best possible code in most cases, but it's does very well for a quick example.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, August 6, 2015 6:45 AM
    Moderator
  • Hi Michelle

    Do I understand correctly that you'd like to add this template name to the list on the "new worksheet" tab? So that when the user clicks it a new worksheet based on the template is inserted?

    It might be better if I move this question to the Excel for Developers forum where the specialists hang out...?


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, August 6, 2015 6:45 PM
    Moderator