98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel Training and help » Boxes
Boxes
Resolved · Low Priority · Version 2010
Bradley has attended:
Excel Intermediate course
Boxes
Please canyou remind me how to create the message box that should appear just before I close my worksheet?
Thanks
RE: Boxes
Hi Bradley
Thanks for your question
Can you clarify your question for me. Why do you want the message box to appear before closing your worksheet? What options do you want it to present
Thanks
Stephen
RE: Boxes
Hi Stephen,
yesterday at the end of our training session, you showed us how to create a message box in VBS.
I think the message box came up just before we went to close the Excel workbook but I cant remember exactly.
We are able to customise the message box to say anything we wanted it to say.
Thanks.
Bradley.
RE: Boxes
Hi Bradley,
Thank you for your question.
Please follow these instructions:
1. Open the workbook first.
2. Then Alt + F11 on the keyboard.
3. In the Project Explorer window on left of screen, find the VBAProject with your workbook name and expand it if necessary using the + symbol.
4. From the list of Objects double click on workbook.
5. A new window appears on the right hand side.
6. From the first drop down box at the top choose Workbook.
7. From the second combo box to the right, choose BeforeClose.
8. The following should then appear:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
msgbox "Enjoy your evening"
End Sub
9. Between Private Sub and End sub type the following as shown above.
10. Close the VBA window using the red X and everytime you close the workbook the message appears.
I hope this answers your question. Let me know.
Regards
Simon
Will be marked as resolved in 5 days
Notice: This is an automated message. Due to inactivity, this forum post will be marked as 'resolved' if there are no further responses in the next 5 days.
Mon 18 Jul 2011: Automatically marked as resolved.
Training information:
See also:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Editing a formula quicklyIf you want to edit a fomrula or text quickly witin a cell instead of the formula bar, you can click either double click in the cell or press the F2 key |