View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default If statements and drop down menues 03

There are a number of ways to do this, but none of them particularly simple
for a non-expert.

One reasonably simple way is to create autotext entries with the name of
each foreman each of which contains the phone number.

Then you would have the following macro run on exit from the DropDown
formfield

Sub GetPhone()
Dim myDrop As DropDown
Dim Foreman As String, PhoneNum As String
Set myDrop = ActiveDocument.FormFields("Foremen").DropDown
Foreman = myDrop.ListEntries(myDrop.Value).Name
Foreman = Mid(Foreman, InStr(Foreman, " ") + 1)
PhoneNum = ActiveDocument.AttachedTemplate.AutoTextEntries(Fo reman).Value
ActiveDocument.FormFields("PhoneNumber").Result = PhoneNum
End Sub

It assumes that the DropDown that contains the names of the foremen has the
bookmark name of "Foremen" assigned to it and that there is another
formfield with the bookmark name of "PhoneNumber" in which the phone number
is to be displayed. It also assumes that your drop down contains the first
and the last name of each foreman and that the names of the autotext entries
are the last names of the foremen.

For information on setting a macro to run on exit from a formfield, see:

http://www.mousetrax.com/techpage.html#autoforms

To learn what to do with the code provided above, see the article "What do I
do with macros sent to me by other newsgroup readers to help me out?" at:

http://www.word.mvps.org/FAQs/Macros...eateAMacro.htm

If you happen to have two foremen with the same last name, the above method
will not be satisfactory

--
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

"blwrs" wrote in message
...
I'm using word 2003. I currently have a dropdown menu named "Dropdown1"
which lists the names of some project foreman. I would like to set up
another area on my paper which automatically inserts each foremans phone
number when his/her name is selected from the drop down list. I have not
been able to make this work. please help! Also i'm by no means a Word
expert
so you will have to really walk me through it. "go to here", "select
this"
that kind of information would be great.
thank you.