Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a new Excel File based on a template in VBA

Tags:

excel

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.

Thanks,

like image 358
thebiglebowski11 Avatar asked Feb 06 '12 19:02

thebiglebowski11


1 Answers

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

like image 126
iDevlop Avatar answered Oct 23 '22 11:10

iDevlop