getting result of dropdown box

G

Guest

I have been enjoying the use of the expression

String = ActiveDocument.Bookmarks("Text1").Range.Fields(1).Result

because it will get the content of Text1 without making the document jump to
the field like

String = ActiveDocument.FormFields("Text1").Result

does.

Unfortunately, this same approach doesn't work with dropdown fields. Does
anyone know how to get the result of a dropdown field without the document
jumping to that field?

-Brian
 
D

Doug Robbins - Word MVP

Hi Brian,

Use:

ActiveDocument.Bookmarks("DropDown1").Range.FormFields(1).DropDown.Value

Not that I use formfields very much, mostly using userforms instead, but I
have never experienced the behaviour that you mention when using

ActiveDocument.Formfields("BookmarkName").Result

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
 
G

Guest

I'm getting a "requested member of collection does not exist" error. I'm
sure that I have the bookmark name spelled correctly.

(Should mention for sake of completion that I am using Word 97. Sorry for
omitting it with the initial post)

-Brian
 
D

Doug Robbins - Word MVP

Hi Brian,

Sorry, I thought that was working, but obviously, my
testing was flawed. Looks like you will have to use

ActiveDocument.Formfields("Dropdown1").Result

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
 
G

Guest

Doug, I was able to use a variation on your post with good results. I can
use this

Dim myDrop as DropDown, myVar as String
Set myDrop = ActiveDocument.FormFields("DropDown1").DropDown
mvVar = myDrop.ListEntries(myDrop.Value).Name

This doesn't seem to make the document jump as it reads the results of the
dropdown. Thanks for the help.

-Brian
 

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