Before Save code

K

Kelly

I have an excel spreadsheet where I have cells that are mandatory to fill in.
I used the Before Save code in Thisworkbook and it worked. Now how can I
suspend this action so I can save the file myself?
 
O

Otto Moehrbach

Well, as written, you can't. Not without satisfying the conditions of the
save macro. A way around this is to have another condition in the macro
that will bypass the check if present.
Of course, if saving the file is your only purpose and you don't intend for
anyone to use it in the short term, you can always remark-out that code.
HTH Otto
 
D

Dave Peterson

One way is to disable events first.

In the VBE
show the immediate window
type this
application.enableevents = false
and hit enter

Then save your file.

Then turn events back on
application.enableevents = True

You may want to create a macro that does the same:

Option Explicit
Option Private Module
Sub SecretSave()
application.enableevents = false
thisworkbook.save
application.enableevents = true
End Sub
 
Top