Displaying messages

C

Claudia

Hello,

Can anyone provide me with code that will display a
message at the beginning of a macro and at the end when it
finishes running?

Thank You
 
S

Simon Lloyd

Claudia, try this........

Dim msgentry as String
Msgentry= "type your message here"
MsgBox msgentry, vbOKOnly, "type the title of the message box here"

The vbOkOnly means the message box will only have an ok button to b
clicked to move on, you only need to type Dim msgentry as String onc
at the top of your code, the rest of it you can use where you like, bu
be warned where ever you put it in your code what ever is taking plac
up to that box will stop until ok is clicked (useful if your checkin
code to see if it works to a certain point!).

Hope this helps

Simo
 
E

Earl Kiosterud

Claudia,

A MsgBox will stop and wait for the user to click something to dismiss the
msgbox and continue the macro. Alternatives include putting a message on
the status bar:

Application.StatusBar = "Initializing"
.....
Application.StatusBar = "Processing record " & RecordNumber
....
Application.StatusBar = False ' reset status bar to Excel control

Another possibility is to use a modeless UserForm (Excel 2000 and later).
In the properties of the UserForm, set ShowModal to False. Now show it.
UserForm1.Show
The macro will continue running, and can put up other UserForms, MsgBoxes,
etc., and can even change the caption of a label in the first UserForm
that's been sitting there.

Check out www.cpearson.com for the Alerter. You might also be interested in
his progress bar.
 
Top