Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Can't get Ask field to work

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JaneinPA - 18 Sep 2007 14:06 GMT
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
Graham Mayor - 18 Sep 2007 14:58 GMT
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

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> 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
[quoted text clipped - 34 lines]
> Assessment
> Homework n/a n/a n/a n/a n/a
JaneinPA - 18 Sep 2007 16:08 GMT
Wow.  That's a mouthful.  I'll study it and see if I can get it to work.

> 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"},
[quoted text clipped - 53 lines]
> > Assessment
> > Homework n/a n/a n/a n/a n/a
JaneinPA - 20 Sep 2007 14:24 GMT
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

> 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"},
[quoted text clipped - 53 lines]
> > Assessment
> > Homework n/a n/a n/a n/a n/a
Jay Freedman - 20 Sep 2007 16:58 GMT
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.

Signature

Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

> 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
[quoted text clipped - 85 lines]
>>> Assessment
>>> Homework n/a n/a n/a n/a n/a
JaneinPA - 21 Sep 2007 14:50 GMT
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?

> 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
[quoted text clipped - 91 lines]
> >>> Assessment
> >>> Homework n/a n/a n/a n/a n/a
Graham Mayor - 21 Sep 2007 15:14 GMT
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.

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> 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
[quoted text clipped - 111 lines]
>>>>> Assessment
>>>>> Homework n/a n/a n/a n/a n/a
JaneinPA - 21 Sep 2007 15:32 GMT
AH... That works.  Thank you!  Is there a way to make that happen
automatically or is that too much to ask?

> If you are seeing the field codes, then press ALT+F9 to toggle the display
> and show the results.
[quoted text clipped - 115 lines]
> >>>>> Assessment
> >>>>> Homework n/a n/a n/a n/a n/a
JaneinPA - 21 Sep 2007 15:50 GMT
Never mind.  I just opened it again and it worked perfectly.  Thank you,
thank you, thank you!

> If you are seeing the field codes, then press ALT+F9 to toggle the display
> and show the results.
[quoted text clipped - 115 lines]
> >>>>> Assessment
> >>>>> Homework n/a n/a n/a n/a n/a
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.