Eisasuarez
Well-known Member
- Joined
- Mar 23, 2012
- Messages
- 653
Hi All,
All i am trying to do is to STOP any other users apart from a few people to be able to SAVE and SAVEAS (Create Copies)
Now if the person presses SAVE then msgbox "You cannot SAVE" should appear
and
If the person presses SAVE AS top create a copy the MSGBOX "You cannot create copies" Should appear
but for some reason only the first part of the code runs...I dont know how to make the system recognise which one was done to pop up the relevant message
This is the CODE
All i am trying to do is to STOP any other users apart from a few people to be able to SAVE and SAVEAS (Create Copies)
Now if the person presses SAVE then msgbox "You cannot SAVE" should appear
and
If the person presses SAVE AS top create a copy the MSGBOX "You cannot create copies" Should appear
but for some reason only the first part of the code runs...I dont know how to make the system recognise which one was done to pop up the relevant message
This is the CODE
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Environ("Username") <> "LG1" AND Environ("Username") <> "PJ1" Then
SaveAsUI = True Then
MsgBox "You cannot make copies of this Workbook"
Cancel = True
Exit Sub
Else
MsgBox "You do not have permission to SAVE", , "Warning!!!"
Cancel = True
Exit SUB
End If
End Sub