ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Interesting problem (https://www.excelbanter.com/excel-programming/316979-interesting-problem.html)

kdev

Interesting problem
 

I have a bit of code that is supposed to prevent users from saving
however, it is also preventing me from saving the workbook with the bi
of code in!! Does anyone have an idea on how to get the workbook to sav
the bit of code (which goes in the workbook module). Code as follows:


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel A
Boolean)
MsgBox "Can't save"
Cancel = True
End Sub


Thanks

--
kde
-----------------------------------------------------------------------
kdev's Profile: http://www.excelforum.com/member.php...fo&userid=1653
View this thread: http://www.excelforum.com/showthread.php?threadid=31382


AA2e72E

Interesting problem
 
Try:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
select case application.username
case "Your Name"
else
MsgBox "Can't save"
Cancel = True
end select
End Sub


"kdev" wrote:


I have a bit of code that is supposed to prevent users from saving,
however, it is also preventing me from saving the workbook with the bit
of code in!! Does anyone have an idea on how to get the workbook to save
the bit of code (which goes in the workbook module). Code as follows:


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
MsgBox "Can't save"
Cancel = True
End Sub


Thanks!


--
kdev
------------------------------------------------------------------------
kdev's Profile: http://www.excelforum.com/member.php...o&userid=16530
View this thread: http://www.excelforum.com/showthread...hreadid=313824




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

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