Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[b]Before save event simple questions[/b]

Status
Not open for further replies.

nina1

Programmer
Aug 14, 2001
31
0
0
CA
Hi,

My questions might look stupid but I am stack on this event.
I just want this event to be fired when the user click save button and dispyay the message box to check the data before saving it.
My module look like this:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.ScreenUpdating = True
MsgBox "Did you enter all requiered fields", vbCritical, "Check your work"

The first time I created it worked but latter on and when I reopened the work book and click the save button nothing happens.
The event is for "This workbook"
Am I missing something?

Thanks


 
By far I'm no expert, but I just wondered why you trigger the event in beforesave event of Workbook instead of putting the code in the click event of the save button.

Then personally I find it more userfriendly to let vba check datafields on required input and give a message when there isn't any (or any valid) than to display a message every time. Yep more code but less irritation.
But that's me. :)

 
Hi littlewoman,

can you more explicit ... when you say "putting the code in the click event of the save button" ... which save button?

Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
hi Glenn
am I missing something?

quote:
"I just want this event to be fired when the when the user click save button.... "

therefor in answer to your question: the save button nina was talking about and which I presumed was on the sheet or form she uses which made me wonder why she don't uses the event of that button to check data and/or to display messages

is it more clear now ? :)

grtz

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top