Password protect xltm but not xlsm if template opened correctly

pwb100

New Member
Joined
May 12, 2023
Messages
16
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I have spreadsheets that need to be opened by many users. I have saved them as xltm's to prevent overwriting but still have some users that use the 'right click' option to open a file. This then gives them access to the xltm file rather than opeing as an xlsm. Is there anyway to prevent them opening the xltm file without a password but not preventing a resulting xlsm file from requiring a password?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Here's a possibility :
VBA Code:
Private Sub Workbook_Open()
If Right(ThisWorkbook.Name, 5) = ".xltm" Then
    MsgBox "You tried to open the Template file. It will be closed."
    ThisWorkbook.Close False
End If
End Sub
If you want to make changes to the Template, you will need to open as .xlsm, make the changes, and save as .xltm
 
Upvote 0
Solution
That works perfectly - thank you very much for your support.
 
Upvote 0

Forum statistics

Threads
1,215,113
Messages
6,123,165
Members
449,099
Latest member
bes000

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