Asigning a macro to a formfield on exit

M

Mark

I am creating a template for Word 97 upwards

I have created a dropdown formfield with code as follows, but I need to add
some code which assigns to that dropdown which runs a macro on exit which is
"occasion2". Please can someone assist me with some code:

Set myfield = _
ActiveDocument.FormFields.Add(Range:=Selection.Range, _
Type:=wdFieldFormDropDown)

With myfield.DropDown.ListEntries

.Add Name:="on NOT MORE THAN... "
.Add Name:="on an UNLIMITED number of occasions."

End With
 
D

Doug Robbins - Word MVP

With myfield.DropDown
.ListEntries.Add Name:="on NOT MORE THAN... "
.ListEntries.Add Name:="on an UNLIMITED number of occasions."
.ExitMacro = "occasion2"
End With

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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