Save as a macro enabled template

dcoledc

Active Member
Joined
May 6, 2010
Messages
403
I am trying to save a macro enabled template as a template.

For example, I have a workbook called Test.xltm and I want a macro within it to save over it, instead of calling Test1.xls.

The code I am trying to use to no avail is:

Code:
ThisWorkbook.SaveAs FileName:="Test.xltm"

I get errors. Anyone know how to do what I am trying to do.

Just so you know, I want to be able to update a few things and then save as template so later when I go in I don't accidently save changes I didn't mean to.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
You don't say what errors your getting. Or if you have other bits of code that may be throwing errors.

But assuming that you are getting an error saying .... that the file format or extension is not valid ....

Try adding this to the end of your SaveAs code:

Rich (BB code):
ThisWorkbook.SaveAs Filename:="TestA.xltm", FileFormat:= _
        xlOpenXMLTemplateMacroEnabled
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,345
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top