ASK Field: Bookmark not defined.

B

Blake Fry

I am creating a template that I want to prompt the user
to enter certain information when it is opened. For most
of the information, I have used macrobuttons, but in this
particular instance, I want the information (the report's
title) to be entered in several different places i.e.,
footer, title page, etc., so, to keep the user from
having to enter the same data in several different macro
buttons, I just want a single prompt from an ASK field. I
pasted in an AutoNew macro that is supposed to prompt the
question every time a user selects to create a document
from this template. The problem is that I can't ever get
to a point to see whether or not the macro works. For one
thing, I can't get the ASK field to not ask the question
right after I create it, thus answering it, even if I
click "cancel" on the prompt and it has nothing to answer
with, and either inserts the default text if there is
some defined, or nothing. Second, I am having problems
with the bookmark. In the ASK field dialogue box, when I
enter the bookmark name, it doesn't appear in the list of
bookmarks below (although sometimes it does). When I go
to insert the bookmark after the ASK field in my template
and do so through the REF field dialogue box, the
bookmark is nonexistent (although sometimes it is there).
If I insert the bookmark name directly using CNTRL F9, I
get a bookmark not defined. Even if, as sometimes happens
for reasons I havent' figured out, everything works, I
still have the problem of the question being prompted and
inadvertately answered when I just what the field to sit
there and do nothing until a user opens a document based
on the template.

Thanks for any help,

Blake Fry
 
G

Graham Mayor

The bookmark is not created until the ASK prompt is answered. Ignore the
error message in the template when you insert REF by hand. The bookmark will
be defined when the ASK field is used.

A more elegant plan would be to employ a userform to gather data - see
http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail (e-mail address removed)
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
M

macropod

Hi Blake,

Your "bookmark not defined" problem in the REF field stems from the fact
that you're cancelling out of the ASK field before you've given it anything
to bookmark. To get around that, simply create any empty bookmark of the
same name, via Insert|Bookmark.

The next issue is how to get the ASK field only to ASK once, when the
bookmark is empty. You can accomplish that with an IF test, as in:
{QUOTE{IF{BkMrk}= ""{ASK BkMrk Prompt} ""}{BkMrk}}

OK, so how to test that it's working?
1. First, create the ASK field and insert a bookmark of the same name as the
one in the ASK field, just to the left of the left-most brace in the above
field.
2. Select the ASK field and press F9, and the ASK field will pop up. Press
OK, or cancel. Nothing is displayed.
3. Press F9 again, and the ASK field will pop up. Enter some data. Press OK,
or cancel. You data is displayed.
4. Press F9 again, and the ASK field will not pop up.

To restore the field after testing (so that you can save a 'clean'
template), delete & re-create the empty bookmark, via Insert|Bookmark.

With this, your AutoNew macro need do little more than trigger a
fields.update event.

Cheers
PS: If you don't want the results to display where the ASK field is located,
you can reduce the field to:
{IF{BkMrk}= ""{ASK BkMrk Prompt} ""}
 

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