VBA - BeforeSave - NEED HELP

  • Thread starter Thread starter HRobertson
  • Start date Start date
H

HRobertson

I created a form (to be used like a template) in Excel
(saved as xls. not xlt.) In order to ensure that the form
is filled out in it's entirety, I wrote a code in VBA
(using BeforeSave) that will not allow the file to be
saved if certain cells are blank. Unfortunately though, I
am now unable to save my file for others to use...since
these cells are blank. They need to be blank when the
file is open, so that others can fill them in. Any
suggestions would be greatly appreciated. Please help.
Thank You.
 
I use a toolbar button to turn events on and off. In the off position the
event is disabled and you can do what you want. The code also changes
the caption of the button to let me know where I stand. [watch word
wrap]

Private Sub EnableAllEvents()

Select Case Application.EnableEvents
Case False
Application.EnableEvents = True
Application.CommandBars("SB2").Controls(3).Caption = "Disable
Events"
Case True
Application.EnableEvents = False
Application.CommandBars("SB2").Controls(3).Caption = "Enable Events"
End Select
Application.ScreenUpdating = True
End Sub
 
H,

Wrap your code in something like this:

If Application.UserName <> "Bernie Deitrick" Then
MsgBox "I'm running the code"
'Code here
Else
MsgBox "I'm not running the code because you're the guy in
charge."
End If

Of course, change the "Bernie Deitrick" to whatever
Application.UserName returns for you.

HTH,
Bernie
MS Excel MVP
 
Back
Top