View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Hii All!!!! does anybody knows how can i cancel the save and the s

Another variation:

You could paste this into the Thisworkbook module of your workbook through
the VBA editor

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
End Sub

If you need to suspend this code in order to save the file yourself, you
could write a macro (and put it in a code module of your workbook - or in a
code module of your Personal macro workbook and assign it a button on your
toolbar or a hotkey) to toggle events on/off (the BeforeSave event would be
suspended while events are off-allowing you to save the file):

Sub ToggleEvents()
With Application
.EnableEvents = Not .EnableEvents
If .EnableEvents Then
.StatusBar = False
Else: .StatusBar = "Events Are Off"
End If
End With

End Sub


"Alon" wrote:

Hii All!!!! does anybody knows how can i cancel the 'save' and the
'save as' commands fron an excel workbook? does anybody can write a
code to do it, or maybe a different solution...

Thank you,
Alon