Excel – Creating a new Excel File based on a template in VBA


I am building an application in Excel which will enable a user to select from a list of existing excel based tools that have been built. They will select the specific tool and hit a "create new" button. Upon clicking this button, the user will be asked to name the file. After entering the name, a new workbook needs to be created and placed in that specific tool's project folder. I am having trouble implementing this in code. I have been able to find examples of code implementing copying templates from the active workbook, but nothing for creating something that is in another excel file entirely.

I believe I need to make a copy of the workbook that the user needs to recreate and then change the name and place the file in the desired location.

I would post some code to show what I've done so far, but I haven't really made progress.


Best Solution

set wb = workbooks.add("x:\mytemplate.xls") allows you to create a NEW doc and specify the file to be used as a template.