Hello folks,
Your favourite nooby here.
Basically I want to block the 'save' function of an excel workbook. Being a template I want the user to have to Save As, to keep the original template in tact, then they can do whatever they want with it once it's on their local system.
Stopping the save function and displaying a nice message is part 1 of the issue.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = False Then
Cancel = True
MsgBox "You cannot save over this Template. Use 'Save As' and Rename"
End If
End Sub
This works perfectly for that....however, once they have renamed, they STILL need to "Save As" after, which is annoying.
Is there something I can add to this code to stop this once the user has changed the name of the workbook in someway?
I was thinking something along the lines of:
(This is in Toyneycode, the language of my brain and in no way affiliated with Excel!)
If Workbook is called "Template" then run this code (as shown above)
If False, then don't?!
In my brain, as soon as they "saved as" and therefore changed the name of the workbook, the code would realize this and allow them to 'save' as normal again!
Or am I just being too hopeful!
Thanks in advance
Toyney
Bookmarks