Stumbleupon Facebook Twitter Digg Google Delicious Linkedin
TechNews

Have a message appears when the registration and closing of a file?

Posted: 17 Feb 2012

Tags: Have a message appears when the registration and closing of a file Have message appears when the registration and closing file


Have a message appears when the registration and closing of a file?

Source: www.redgiantsoftware.com

Question:

Assistance. New VBA and you all is an excellent resource, with my Excel VBA for Dummies book. Is it possible to write code that would make a message appear in Excel when save them and close a file? Not one "either / or"scenario;"" only when do both.

Answer:

Assistance. New VBA and you all is an excellent resource, with my Excel VBA for Dummies book. Is it possible to write code that would make a message appear in Excel when save them and close a file? Not one "either / or"scenario;"" only when do both.


Hello

Save is an action and closure is another but if you want to only display a message when the workbook is closed is registered then you can test if it is before its closure and then display the message or not.

ALT + F11 to open the VB Editor. Double click on "This workbook" and paste the code below to the right. The message will be displayed only if the workbook has been save but if it does not save you still get the Excel prompts to save.

Private Sub Workbook_BeforeClose(Cancel_As_Boolean)
If Me.Saved then
MsgBox "you close a saved workbook.
End If
End Sub

Rate this article:


  • Pages:
  • 1

0 Comments

Add Your Comment !