access vba course - vba message box


starstarstarstarstar Excellent

Forum home » Delegate support and help forum » Microsoft VBA Training and help » access vba course - Vba Message Box

access vba course - Vba Message Box

resolvedResolved · Low Priority · Version Standard

Mon 9 Jul 2007, 11:38 replyReply Delegate Dimitrios said...

Dimitrios has attended:
Excel Advanced course
Excel VBA Intro Intermediate course

Vba Message Box


I would like to create a message box where it will say: "Copy yesterday's data?". If the user replies yes, then i want it to execute the macro that i have created in VBA (named Main) eitherwise do nothing. So far, my macro lloks like this:

Sub Main()

Application.ScreenUpdating = False
Exit Sub

Dim reply As Integer

reply = MsgBox("Copy Yesterday's Data?", vbYesNo)
If reply = vbYes Then

End If

I am not sure what to add after the THEN in order to make it run the MAIN sub. any help will be greatly appreciated.

For upcoming training course dates see: Pricing & availability

Wed 11 Jul 2007, 15:43 replyReply Trainer Carlos said...

RE: Vba Message Box


After the THEN you enter the following line:

Call Main

This runs the Main macro.




Live dates & prices


Training information:

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


Vba tip:

Stop Screen Flickering When Running Code

Running VBA code may cause the screen to flicker as the monitor is the slowest part of the program and cannot keep up with the very fast changes taking place.

To switch off the screen until the program is run enter the following code line:

Application.ScreenUpdating = False

The screen comes on automatically on completion of the program.

View all VBA hints and tips