gooniegirl180
Board Regular
- Joined
- Aug 13, 2003
- Messages
- 152
Hi all,
I have a file that my users are not permitted to save, but I want my staff to be able to modify and save. I have an old macro from mikerikson which works if my team or I wants to save this master file and enters the appropriate password, thus:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not (SaveAsUI) Then
SavePassword = (Application.InputBox("Enter Password to Save This Masterfile", Type:=2) <> "Barrie")
End If
End Sub
However, the file also has another macro which saves the file as another name, which doesn't require a password - but when that one is run, it calls this one and asks for the password because, I'm guessing, there is no Save-As User Interface.
What code do I have to put into the SAVE AS macro to pass a password to the Workbook_BeforeSave routine, and how do I modify that one to prevent the InputBox popping up?
BTW, regardless of whether I press CANCEL or type in the password, when the Workbook_BeforeSave messagebox pops up, it goes back to the calling macro and does the SAVEAS anyway. Which is OK, but will confuse the heck out of my users....
Thanks,
Gooniegirl180, stuck in a loop
I have a file that my users are not permitted to save, but I want my staff to be able to modify and save. I have an old macro from mikerikson which works if my team or I wants to save this master file and enters the appropriate password, thus:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not (SaveAsUI) Then
SavePassword = (Application.InputBox("Enter Password to Save This Masterfile", Type:=2) <> "Barrie")
End If
End Sub
However, the file also has another macro which saves the file as another name, which doesn't require a password - but when that one is run, it calls this one and asks for the password because, I'm guessing, there is no Save-As User Interface.
What code do I have to put into the SAVE AS macro to pass a password to the Workbook_BeforeSave routine, and how do I modify that one to prevent the InputBox popping up?
BTW, regardless of whether I press CANCEL or type in the password, when the Workbook_BeforeSave messagebox pops up, it goes back to the calling macro and does the SAVEAS anyway. Which is OK, but will confuse the heck out of my users....
Thanks,
Gooniegirl180, stuck in a loop