Creating drop-down list with VBA

  • Thread starter Thread starter LindsayR
  • Start date Start date
L

LindsayR

Am using VBA in Word to create a drop-down list. I want
the list to appear in a bookmarked form field and am
setting it up as an "on-entry" macro....the code I have so
far uses range (which I don't think is right) the
parameters Start: and End send the list to the top of the
form (not good). How can I word the code to have the list
appear in the bookmarked form field referenced in the
code? I know I'm not even close on this one.....

Sample of where I am at.....

Sub Dropdown()

Set ffield = ActiveDocument.FormFields.Add( _
Range:=ActiveDocument.Range(Start:=0, End:=0), _
Type:=wdFieldFormDropDown)

With ffield
.Name = "No1"
With .Dropdown.ListEntries
.Add Name:="Entry 1"
.Add Name:="Entry 2"
.Add Name:="Entry 3"
End With
End Sub
 
The dropdown formfield is being created as the first thing in the document
because that is where

Range:=ActiveDocument.Range(Start:=0, End:=0)

is located.

Where actually do you want the dropdown to be located?

Are you saying that you want the macro to run on entry to another formfield
and replace that formfield or what?

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
Back
Top