Message box

A

Amy

Can someone help me with the code to trigger a message box when a certain
form field has the focus? When someone hits these particular fields, I just
want them to see a reminder about the content of the field.

Thanks in advance!
 
N

NZ VBA Developer

Assuming you're talking about a field on a userform, I suggest looking in the
VBA help for information on the 'Enter' event. The code should look something
like this:

Sub TextBox1_Enter
MsgBox "Don't forget..."
End Sub

However, if you are talking about a form field in document, then the process
is a little different. In this case you will need to create a macro in the
template that looks something like this:

Sub Reminder()
MsgBox "Don't forget..."
End Sub

And then in the properties dialog box of the formfield select this macro to
run on entry to the field. If you don't want the same message displayed for
each field, you'll need to create similar macros for each and assign the
specific macros to the appropriate field.

Note that this only appears to work if the document is forms protected.

Cheers!
 
A

Amy

That's perfect! Thank you so much!

NZ VBA Developer said:
Assuming you're talking about a field on a userform, I suggest looking in the
VBA help for information on the 'Enter' event. The code should look something
like this:

Sub TextBox1_Enter
MsgBox "Don't forget..."
End Sub

However, if you are talking about a form field in document, then the process
is a little different. In this case you will need to create a macro in the
template that looks something like this:

Sub Reminder()
MsgBox "Don't forget..."
End Sub

And then in the properties dialog box of the formfield select this macro to
run on entry to the field. If you don't want the same message displayed for
each field, you'll need to create similar macros for each and assign the
specific macros to the appropriate field.

Note that this only appears to work if the document is forms protected.

Cheers!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top