PDA

View Full Version : Template-document new equivilant in Excel



lucas
06-13-2006, 07:25 AM
I have Excel files I wish to use as templates that contain code....If I create a new file using the template the code is included.

Gerry has been discussing a resolution to this problem in Word and I was wondering if there is an equivilant to document_New in excel. No results from searching.

Gerry's word thread: http://www.vbaexpress.com/forum/showthread.php?p=66228#post66228

mdmackillop
06-13-2006, 08:45 AM
Hi Steve
Why not save your code in an XLA file
Regards
Malcolm

lucas
06-13-2006, 10:20 AM
Sounds like my best bet so far Malcolm. Thanks for the tip

lucas
06-13-2006, 10:34 AM
I have been using this on workbook open:

Private Sub Workbook_Open()
ActiveWorkbook.SaveAs FileName:="F:\Temp\BOM.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
Application.Run "checkname"
End Sub


Then I have a sheet with a button to run code to:

get a directory file listing,
combine files in the directory into this workbook,
sort sheets(at the end of the sort routine I run a delete code and sheet routine)

so the end result is a file I can email. I just have been going through the process of copying the workbook each time...run the code....delete the code and sheet...ready to go. Sounds really busy doesn't it?