Can't get Ask field to work

J

JaneinPA

I am a teacher & have a lesson plan template. I want to be able to go to
file>>new, choose the lesson plan template & when it opens it gives me a box
to enter the "week of." Then I want this information automatically inserted
into the lesson plan file in three places. I almost had it working, then I
somehow screwed it up! I hope someone can steer me in the right direction to
get it working.

Here's what I have currently:

{ASK "Week"\*MERGEFORMAT}{QUOTE "Week"\*MERGEFORMAT}Lesson Plans
CAPPS – Computer Applications


Teacher: Allison Grade: 5 Week of: {Week}
Monday Tuesday Wednesday Thursday Friday
Objectives
Methods
Assessment
Homework n/a n/a n/a n/a n/a



Lesson Plans
CAPPS – Computer Applications


Teacher: Allison Grade: 6 Week of: {Week}
Monday Tuesday Wednesday Thursday Friday
Objectives
Methods
Assessment
Homework n/a n/a n/a n/a n/a




Lesson Plans
CAPPS – Computer Applications


Teacher: Allison Grade: 7 Week of: {Week}
Monday Tuesday Wednesday Thursday Friday
Objectives
Methods
Assessment
Homework n/a n/a n/a n/a n/a
 
G

Graham Mayor

The Mergeformat switches are superfluous and in theory the ASK field should
have both a bookmark name and a prompt e.g. { ASK Week "Enter the Week"},
but in practice it will work as it stands. The QUOTE field should be a REF
field but apart from that what you need is an autonew macro in the template
to force the update. You can either add the update sample code at
http://www.gmayor.com/installing_macro.htm to a toolbar button in normal.dot
and have it available universally, or you can add the following *to your
template*.

Sub AutoNew()
Dim oStory As Range
Dim oField As Field
For Each oStory In ActiveDocument.StoryRanges
For Each oField In oStory.Fields
oField.Update
Next oField
Next oStory
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

JaneinPA

I've been fiddling with this for days & I'm afraid I'm hopelessly confused.
Let me tell you what I've done. I started over from scratch.

1. I have my lesson plan template without any field codes at all.
2. I went to the top of the file and inserted an ASK field code, as in ASK
Week "Enter Week of" When the box comes up I hit enter without entering any
info
3. Then I went to the 3 places on the form where I want to enter the "week
of"
4. I inserted a cross reference to the bookmark called Week
5. I Then went to tools, Macros and created a macro called autoupdate and
typed all of the lines of code you gave me.
6. I saved the template, then went to file>>new and opened a new lesson
plan, but I just get the page with all the field codes visible. No window
opens to ask for my "Week of" etc.

Can you help me determine where I went wrong? I'd really like to understand
this (although I don't understand your visual basic at all!)

Jane
 
J

Jay Freedman

The problem is the name of the macro. The name Graham showed, AutoNew, is
one of a handful of special names that Word runs automatically under certain
conditions (see http://www.word.mvps.org/FAQs/MacrosVBA/DocumentEvents.htm).
The name Autoupdate has no special significance, so it isn't running. Change
it to AutoNew in the template.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

JaneinPA

I fixed the macro name and now it works fine. However, when I enter the text
I want to show up in the 3 fields, nothing happens. It is not inserted. I
just see the field codes. Here are the codes I have currently

{ASK Week "Enter Week of"\* MERGEFORMAT}{REF Week}

Then at the other 2 occurrences I have {REF Week \h}

Am I close?
 
G

Graham Mayor

If you are seeing the field codes, then press ALT+F9 to toggle the display
and show the results.
The \* Mergeformat switch is not required on the ASK field.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

JaneinPA

AH... That works. Thank you! Is there a way to make that happen
automatically or is that too much to ask?
 
J

JaneinPA

Never mind. I just opened it again and it worked perfectly. Thank you,
thank you, thank you!
 

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