Compare Value of a Bookmark

T

Tom

I am creating some templates. Normally I would use a
FILLIN Field to get information from the user however I
want to excecute certain lines of code based on the
answer. So I am using ASK and storing the info in a
bookmark. However I don't know how to compare the value
of a bookmark in an If statement.

Selection.Fields.Add Range:=Selection.Range,
Type:=wdFieldEmpty,
Text:= _ "ASK someBookmark ""Prompt:"" ",
PreserveFormatting:=True

If someBookmark = "TEST" Then (This does not work)
End if

Any suggestions would be greatly appreciated.

Thanks,

Tom
 
D

Doug Robbins - Word MVP

Hi Tom,

Use a { REF } field to get the text of the bookmark.

However, I think you would really be better off to use a userform. See the
article "How to create a Userform" at:

http://www.mvps.org/word/FAQs/Userforms/CreateAUserForm.htm

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
 
T

Tom

Thanks for the help. The { REF } works in the word file
but not in the macro. I tried if { REF bookmarkName} =
but it didn't like the "{". I also tried it without the
brackets then it expected a "then" instead of
bookmarkName.

However the Userform works great. I had ruled that out
in my head awhile ago without even trying it. But it
does work fine I don't know what I was thinking.

Thanks again,

Tom
 

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