Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

boxes

ResolvedVersion 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.

Excel tip:

No Zeros

Want all the zeros in your worksheet to appear blank? Choose Tools/Options, Click on the View Tab, Deselect the Zero Values Option, Click OK.
Easy wasn't it? But be aware that these cells are not actually blank, they still contain the value zero. This is important because certain functions (ie AVERAGE) make a distinction between blank cells and those with a zero value.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.