Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Asigning a macro to a formfield on exit

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark - 11 Jan 2006 21:57 GMT
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

Signature

Mark

Doug Robbins - Word MVP - 12 Jan 2006 05:19 GMT
With myfield.DropDown
   .ListEntries.Add Name:="on NOT MORE THAN... "
   .ListEntries.Add Name:="on an UNLIMITED number of occasions."
   .ExitMacro = "occasion2"
End With

Signature

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

>I am creating a template for Word 97 upwards
>
[quoted text clipped - 14 lines]
>
>        End With
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.