ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs Question (https://www.excelbanter.com/excel-programming/372570-saveas-question.html)

Rob

SaveAs Question
 
I was wondering if there was amethod of capturing the SaveAs and disabling it
before the user tries to use it? I have this code for the Save but it still
allows the user to use SaveAs.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

If Application.UserName < "rcj" Then

Cancel = True
MsgBox "Sorry, But You Don't Have Permission To Save This File",
vbExclamation, "Invalid Permission"

End If

'MsgBox Application.UserName

End Sub


Thanks In Advance,
Rob

Dave Peterson

SaveAs Question
 
This should stop any File|Save or File|SaveAs.

Maybe you turned off events (application.enableevents = false) and forgot to
reenable it???

Or maybe the workbook was opened and macros were disabled???

Rob wrote:

I was wondering if there was amethod of capturing the SaveAs and disabling it
before the user tries to use it? I have this code for the Save but it still
allows the user to use SaveAs.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

If Application.UserName < "rcj" Then

Cancel = True
MsgBox "Sorry, But You Don't Have Permission To Save This File",
vbExclamation, "Invalid Permission"

End If

'MsgBox Application.UserName

End Sub

Thanks In Advance,
Rob


--

Dave Peterson

Rob

SaveAs Question
 
Sweet It Works. Thanks.

"Dave Peterson" wrote:

This should stop any File|Save or File|SaveAs.

Maybe you turned off events (application.enableevents = false) and forgot to
reenable it???

Or maybe the workbook was opened and macros were disabled???

Rob wrote:

I was wondering if there was amethod of capturing the SaveAs and disabling it
before the user tries to use it? I have this code for the Save but it still
allows the user to use SaveAs.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

If Application.UserName < "rcj" Then

Cancel = True
MsgBox "Sorry, But You Don't Have Permission To Save This File",
vbExclamation, "Invalid Permission"

End If

'MsgBox Application.UserName

End Sub

Thanks In Advance,
Rob


--

Dave Peterson



All times are GMT +1. The time now is 03:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com