Determine if file format is a template

rjplante

Well-known Member
Joined
Oct 31, 2008
Messages
574
Office Version
  1. 365
Platform
  1. Windows
I would like to check to see if the current file format is a macro enabled template file and then initiate a save as command if it is. I am using the code below and I was wondering if this would work, or if there is a different code I should be using.

Code:
 If ActiveWorkbook.FileFormat = ".xlst" Then
    MsgBox"Current workbook is an Excel template. The workbook will be saved as a macro enabled workbook."
    
     'I have my save command here

Else
     Exit sub

End if
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I think you should be using

Code:
ActiveWorkbook.FileFormat = 53
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

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