Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling (or deleting) VBA code 1

Status
Not open for further replies.

ballbearing

Technical User
Jan 7, 2004
43
US
When saving a .xlt file to .xls, any code contained within the .xlt is saved in the .xls file as well. There are some things that I may not want the .xls file to do that the .xlt file does. Is there a way to code the .xlt so that it disables any code in the .xls?

Clear as mud. Right?

Thanks
Randy

Gawd I love this Access stuff..too bad I don't know what I'm doing.
 
If your code is in regular module sheets, or the ThisWorkbook code pane, you can exclude it from your template by using ActiveSheet.Copy to create a new workbook containing only the active sheet. This new workbook will contain only the code found on the code pane of the worksheet in the original workbook--which may be nothing in your case
Code:
ActiveSheet.Copy
ActiveWorkbook.SaveAs "C:\TEMP\XXXX.XLT",fileformat:=xltemplate
ActiveWorkbook.Close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top