As the subject says, I'd like to create a macro-enabled template that stems read-only workbooks. The workbooks should/will generally never be saved as they're just used as calculators. I started with a macro-enabled workbook but everyone in our team has expressed desire to have multiple instances of the "calculator" workbook open at the same time. I thought I could solve this by making it a macro-enabled template but then each stemmed workbook always asks if you want to save it when closed which can be a pretty big annoyance as much as we use the calculator.
Here's the code I've been using for the original workbook but with the template I'm getting a 1004 error: "method 'changefileaccess' of object '_workbook' failed". It makes sense to me that you couldn't change the file access if the file hasn't been saved yet but now I don't have a way to stop the save requests. Any ideas?
Here's the code I've been using for the original workbook but with the template I'm getting a 1004 error: "method 'changefileaccess' of object '_workbook' failed". It makes sense to me that you couldn't change the file access if the file hasn't been saved yet but now I don't have a way to stop the save requests. Any ideas?
VBA Code:
Private Sub Workbook_Open()
ActiveWorkbook.EnableAutoRecover = False
If Range("UserName").Value = "" Then
frmGetUser.Show
ElseIf Range("UserName").Value = "Admin" Then
'ThisWorkbook.ChangeFileAccess Mode:=xlReadWrite
MsgBox ("Administrative mode active")
Else
Application.DisplayAlerts = False
ThisWorkbook.ChangeFileAccess Mode:=xlReadOnly
Application.DisplayAlerts = True
End If
End Sub