I have designed a report template using ASK fields (the report cannot be
protected and tables are not practical). A macro placed in the ThisDocument
module prompts the ASK fields and it all works beautifully except that whilst
the prompts for the ASK fields are on screen you can see the document behind
and where the bookmark for the ASK fields are it displays "Error Bookmark not
Defined" - however when they are all filled in the error disappears and the
data that was typed in the boxes appears in the correct fields, but I can't
have users seeing the error messages it would confuse them.

I have tried all sorts of ways but cannot find how to hide the window whilst
the fields are updating. I've tried Application.ScreenUpdating = False, but
it didn't work. Anyone have an idea?

The code is:

Sub AutoNew()

Dim oStory As Range

For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing

Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"

End Sub

Thanks for looking at this.
Jeanmac

Re: Error whilst fields are updating by Jezebel

Jezebel
Tue Sep 20 05:02:22 CDT 2005

Why not use ordinary form fields? Then you wouldn't need the macro or the
updating at all... Break the document into sections, and protect only the
sections containing the fields.




"jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
news:E81D52A8-0651-43EE-B8CC-81E1554057CF@microsoft.com...
>I have designed a report template using ASK fields (the report cannot be
> protected and tables are not practical). A macro placed in the
> ThisDocument
> module prompts the ASK fields and it all works beautifully except that
> whilst
> the prompts for the ASK fields are on screen you can see the document
> behind
> and where the bookmark for the ASK fields are it displays "Error Bookmark
> not
> Defined" - however when they are all filled in the error disappears and
> the
> data that was typed in the boxes appears in the correct fields, but I
> can't
> have users seeing the error messages it would confuse them.
>
> I have tried all sorts of ways but cannot find how to hide the window
> whilst
> the fields are updating. I've tried Application.ScreenUpdating = False,
> but
> it didn't work. Anyone have an idea?
>
> The code is:
>
> Sub AutoNew()
>
> Dim oStory As Range
>
> For Each oStory In ActiveDocument.StoryRanges
> oStory.Fields.Update
> If oStory.StoryType <> wdMainTextStory Then
> While Not (oStory.NextStoryRange Is Nothing)
> Set oStory = oStory.NextStoryRange
> oStory.Fields.Update
> Wend
> End If
> Next oStory
> Set oStory = Nothing
>
> Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
>
> End Sub
>
> Thanks for looking at this.
> Jeanmac



Re: Error whilst fields are updating by jeanmac

jeanmac
Tue Sep 20 09:18:18 CDT 2005

Trouble is if I do that the document is protected and has reduced
functionality which is not what the users want. The reason why I used ASK
fields is because the bookmark is inserted twice to update information in the
footer and on the back page of the document. Hence the reason for wanting to
know if I can do anything with the bookmarks when the document first opens.

"Jezebel" wrote:

> Why not use ordinary form fields? Then you wouldn't need the macro or the
> updating at all... Break the document into sections, and protect only the
> sections containing the fields.
>
>
>
>
> "jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
> news:E81D52A8-0651-43EE-B8CC-81E1554057CF@microsoft.com...
> >I have designed a report template using ASK fields (the report cannot be
> > protected and tables are not practical). A macro placed in the
> > ThisDocument
> > module prompts the ASK fields and it all works beautifully except that
> > whilst
> > the prompts for the ASK fields are on screen you can see the document
> > behind
> > and where the bookmark for the ASK fields are it displays "Error Bookmark
> > not
> > Defined" - however when they are all filled in the error disappears and
> > the
> > data that was typed in the boxes appears in the correct fields, but I
> > can't
> > have users seeing the error messages it would confuse them.
> >
> > I have tried all sorts of ways but cannot find how to hide the window
> > whilst
> > the fields are updating. I've tried Application.ScreenUpdating = False,
> > but
> > it didn't work. Anyone have an idea?
> >
> > The code is:
> >
> > Sub AutoNew()
> >
> > Dim oStory As Range
> >
> > For Each oStory In ActiveDocument.StoryRanges
> > oStory.Fields.Update
> > If oStory.StoryType <> wdMainTextStory Then
> > While Not (oStory.NextStoryRange Is Nothing)
> > Set oStory = oStory.NextStoryRange
> > oStory.Fields.Update
> > Wend
> > End If
> > Next oStory
> > Set oStory = Nothing
> >
> > Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
> >
> > End Sub
> >
> > Thanks for looking at this.
> > Jeanmac
>
>
>

Re: Error whilst fields are updating by Jezebel

Jezebel
Tue Sep 20 23:12:59 CDT 2005

What reduced functionality? You need protect only the *sections* containing
the fields: the other sections can be unprotected and fully functional.




"jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
news:03A54D15-5A38-45B9-B007-429A15D5ED22@microsoft.com...
> Trouble is if I do that the document is protected and has reduced
> functionality which is not what the users want. The reason why I used ASK
> fields is because the bookmark is inserted twice to update information in
> the
> footer and on the back page of the document. Hence the reason for wanting
> to
> know if I can do anything with the bookmarks when the document first
> opens.
>
> "Jezebel" wrote:
>
>> Why not use ordinary form fields? Then you wouldn't need the macro or the
>> updating at all... Break the document into sections, and protect only the
>> sections containing the fields.
>>
>>
>>
>>
>> "jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
>> news:E81D52A8-0651-43EE-B8CC-81E1554057CF@microsoft.com...
>> >I have designed a report template using ASK fields (the report cannot be
>> > protected and tables are not practical). A macro placed in the
>> > ThisDocument
>> > module prompts the ASK fields and it all works beautifully except that
>> > whilst
>> > the prompts for the ASK fields are on screen you can see the document
>> > behind
>> > and where the bookmark for the ASK fields are it displays "Error
>> > Bookmark
>> > not
>> > Defined" - however when they are all filled in the error disappears and
>> > the
>> > data that was typed in the boxes appears in the correct fields, but I
>> > can't
>> > have users seeing the error messages it would confuse them.
>> >
>> > I have tried all sorts of ways but cannot find how to hide the window
>> > whilst
>> > the fields are updating. I've tried Application.ScreenUpdating =
>> > False,
>> > but
>> > it didn't work. Anyone have an idea?
>> >
>> > The code is:
>> >
>> > Sub AutoNew()
>> >
>> > Dim oStory As Range
>> >
>> > For Each oStory In ActiveDocument.StoryRanges
>> > oStory.Fields.Update
>> > If oStory.StoryType <> wdMainTextStory Then
>> > While Not (oStory.NextStoryRange Is Nothing)
>> > Set oStory = oStory.NextStoryRange
>> > oStory.Fields.Update
>> > Wend
>> > End If
>> > Next oStory
>> > Set oStory = Nothing
>> >
>> > Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
>> >
>> > End Sub
>> >
>> > Thanks for looking at this.
>> > Jeanmac
>>
>>
>>



Re: Error whilst fields are updating by jeanmac

jeanmac
Wed Sep 21 05:56:07 CDT 2005

As far as I am aware,when part of a document is protected, you can't do some
things like formatting bullets and numbers, restart numbering, continue
numbering and other things. It would be great if you know of a way of that
not happening.

"Jezebel" wrote:

> What reduced functionality? You need protect only the *sections* containing
> the fields: the other sections can be unprotected and fully functional.
>
>
>
>
> "jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
> news:03A54D15-5A38-45B9-B007-429A15D5ED22@microsoft.com...
> > Trouble is if I do that the document is protected and has reduced
> > functionality which is not what the users want. The reason why I used ASK
> > fields is because the bookmark is inserted twice to update information in
> > the
> > footer and on the back page of the document. Hence the reason for wanting
> > to
> > know if I can do anything with the bookmarks when the document first
> > opens.
> >
> > "Jezebel" wrote:
> >
> >> Why not use ordinary form fields? Then you wouldn't need the macro or the
> >> updating at all... Break the document into sections, and protect only the
> >> sections containing the fields.
> >>
> >>
> >>
> >>
> >> "jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
> >> news:E81D52A8-0651-43EE-B8CC-81E1554057CF@microsoft.com...
> >> >I have designed a report template using ASK fields (the report cannot be
> >> > protected and tables are not practical). A macro placed in the
> >> > ThisDocument
> >> > module prompts the ASK fields and it all works beautifully except that
> >> > whilst
> >> > the prompts for the ASK fields are on screen you can see the document
> >> > behind
> >> > and where the bookmark for the ASK fields are it displays "Error
> >> > Bookmark
> >> > not
> >> > Defined" - however when they are all filled in the error disappears and
> >> > the
> >> > data that was typed in the boxes appears in the correct fields, but I
> >> > can't
> >> > have users seeing the error messages it would confuse them.
> >> >
> >> > I have tried all sorts of ways but cannot find how to hide the window
> >> > whilst
> >> > the fields are updating. I've tried Application.ScreenUpdating =
> >> > False,
> >> > but
> >> > it didn't work. Anyone have an idea?
> >> >
> >> > The code is:
> >> >
> >> > Sub AutoNew()
> >> >
> >> > Dim oStory As Range
> >> >
> >> > For Each oStory In ActiveDocument.StoryRanges
> >> > oStory.Fields.Update
> >> > If oStory.StoryType <> wdMainTextStory Then
> >> > While Not (oStory.NextStoryRange Is Nothing)
> >> > Set oStory = oStory.NextStoryRange
> >> > oStory.Fields.Update
> >> > Wend
> >> > End If
> >> > Next oStory
> >> > Set oStory = Nothing
> >> >
> >> > Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
> >> >
> >> > End Sub
> >> >
> >> > Thanks for looking at this.
> >> > Jeanmac
> >>
> >>
> >>
>
>
>

Re: Error whilst fields are updating by Jezebel

Jezebel
Thu Sep 22 03:13:15 CDT 2005

Only in the protected section. The rest is fine. Designing the document
around that constraint is a hell of a lot easier than running macros on
other people's computers.


"jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
news:9E95BAA1-4A22-4AC3-997B-5E04E3577144@microsoft.com...
> As far as I am aware,when part of a document is protected, you can't do
> some
> things like formatting bullets and numbers, restart numbering, continue
> numbering and other things. It would be great if you know of a way of
> that
> not happening.
>
> "Jezebel" wrote:
>
>> What reduced functionality? You need protect only the *sections*
>> containing
>> the fields: the other sections can be unprotected and fully functional.
>>
>>
>>
>>
>> "jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
>> news:03A54D15-5A38-45B9-B007-429A15D5ED22@microsoft.com...
>> > Trouble is if I do that the document is protected and has reduced
>> > functionality which is not what the users want. The reason why I used
>> > ASK
>> > fields is because the bookmark is inserted twice to update information
>> > in
>> > the
>> > footer and on the back page of the document. Hence the reason for
>> > wanting
>> > to
>> > know if I can do anything with the bookmarks when the document first
>> > opens.
>> >
>> > "Jezebel" wrote:
>> >
>> >> Why not use ordinary form fields? Then you wouldn't need the macro or
>> >> the
>> >> updating at all... Break the document into sections, and protect only
>> >> the
>> >> sections containing the fields.
>> >>
>> >>
>> >>
>> >>
>> >> "jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
>> >> news:E81D52A8-0651-43EE-B8CC-81E1554057CF@microsoft.com...
>> >> >I have designed a report template using ASK fields (the report cannot
>> >> >be
>> >> > protected and tables are not practical). A macro placed in the
>> >> > ThisDocument
>> >> > module prompts the ASK fields and it all works beautifully except
>> >> > that
>> >> > whilst
>> >> > the prompts for the ASK fields are on screen you can see the
>> >> > document
>> >> > behind
>> >> > and where the bookmark for the ASK fields are it displays "Error
>> >> > Bookmark
>> >> > not
>> >> > Defined" - however when they are all filled in the error disappears
>> >> > and
>> >> > the
>> >> > data that was typed in the boxes appears in the correct fields, but
>> >> > I
>> >> > can't
>> >> > have users seeing the error messages it would confuse them.
>> >> >
>> >> > I have tried all sorts of ways but cannot find how to hide the
>> >> > window
>> >> > whilst
>> >> > the fields are updating. I've tried Application.ScreenUpdating =
>> >> > False,
>> >> > but
>> >> > it didn't work. Anyone have an idea?
>> >> >
>> >> > The code is:
>> >> >
>> >> > Sub AutoNew()
>> >> >
>> >> > Dim oStory As Range
>> >> >
>> >> > For Each oStory In ActiveDocument.StoryRanges
>> >> > oStory.Fields.Update
>> >> > If oStory.StoryType <> wdMainTextStory Then
>> >> > While Not (oStory.NextStoryRange Is Nothing)
>> >> > Set oStory = oStory.NextStoryRange
>> >> > oStory.Fields.Update
>> >> > Wend
>> >> > End If
>> >> > Next oStory
>> >> > Set oStory = Nothing
>> >> >
>> >> > Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
>> >> >
>> >> > End Sub
>> >> >
>> >> > Thanks for looking at this.
>> >> > Jeanmac
>> >>
>> >>
>> >>
>>
>>
>>



Re: Error whilst fields are updating by macropod

macropod
Thu Sep 22 04:48:28 CDT 2005

Hi jeanmac,

The *really* simple solution is to insert the bookmarks created/maintained
by the ASK fields into your template manually. For example, say you have a
field:
{ASK Age "How old are you?"}
Position the cursor immediately before this field, with nothing selected,
and use Insert|Bookmark to insert an 'Age' bookmark at that point. In fact,
you can insert these anywhere in the template, but next to the fields is
handy.

Do this with all of the fields but DON'T UPDATE THEM before saving the
template. If you do, you'll have to repeat the above process.

Now, when the template is opened, you won't get the "Error Bookmark not
Defined" message, but the required prompts will occur.

Cheers


"jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
news:E81D52A8-0651-43EE-B8CC-81E1554057CF@microsoft.com...
> I have designed a report template using ASK fields (the report cannot be
> protected and tables are not practical). A macro placed in the
ThisDocument
> module prompts the ASK fields and it all works beautifully except that
whilst
> the prompts for the ASK fields are on screen you can see the document
behind
> and where the bookmark for the ASK fields are it displays "Error Bookmark
not
> Defined" - however when they are all filled in the error disappears and
the
> data that was typed in the boxes appears in the correct fields, but I
can't
> have users seeing the error messages it would confuse them.
>
> I have tried all sorts of ways but cannot find how to hide the window
whilst
> the fields are updating. I've tried Application.ScreenUpdating = False,
but
> it didn't work. Anyone have an idea?
>
> The code is:
>
> Sub AutoNew()
>
> Dim oStory As Range
>
> For Each oStory In ActiveDocument.StoryRanges
> oStory.Fields.Update
> If oStory.StoryType <> wdMainTextStory Then
> While Not (oStory.NextStoryRange Is Nothing)
> Set oStory = oStory.NextStoryRange
> oStory.Fields.Update
> Wend
> End If
> Next oStory
> Set oStory = Nothing
>
> Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
>
> End Sub
>
> Thanks for looking at this.
> Jeanmac



Re: Error whilst fields are updating by jeanmac

jeanmac
Thu Sep 22 10:40:04 CDT 2005

Thanks macropod! I got round it in the end by giving a default of an empty
text string to all the fields, but that's a bit excessive, your solution is
much better.

"macropod" wrote:

> Hi jeanmac,
>
> The *really* simple solution is to insert the bookmarks created/maintained
> by the ASK fields into your template manually. For example, say you have a
> field:
> {ASK Age "How old are you?"}
> Position the cursor immediately before this field, with nothing selected,
> and use Insert|Bookmark to insert an 'Age' bookmark at that point. In fact,
> you can insert these anywhere in the template, but next to the fields is
> handy.
>
> Do this with all of the fields but DON'T UPDATE THEM before saving the
> template. If you do, you'll have to repeat the above process.
>
> Now, when the template is opened, you won't get the "Error Bookmark not
> Defined" message, but the required prompts will occur.
>
> Cheers
>
>
> "jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
> news:E81D52A8-0651-43EE-B8CC-81E1554057CF@microsoft.com...
> > I have designed a report template using ASK fields (the report cannot be
> > protected and tables are not practical). A macro placed in the
> ThisDocument
> > module prompts the ASK fields and it all works beautifully except that
> whilst
> > the prompts for the ASK fields are on screen you can see the document
> behind
> > and where the bookmark for the ASK fields are it displays "Error Bookmark
> not
> > Defined" - however when they are all filled in the error disappears and
> the
> > data that was typed in the boxes appears in the correct fields, but I
> can't
> > have users seeing the error messages it would confuse them.
> >
> > I have tried all sorts of ways but cannot find how to hide the window
> whilst
> > the fields are updating. I've tried Application.ScreenUpdating = False,
> but
> > it didn't work. Anyone have an idea?
> >
> > The code is:
> >
> > Sub AutoNew()
> >
> > Dim oStory As Range
> >
> > For Each oStory In ActiveDocument.StoryRanges
> > oStory.Fields.Update
> > If oStory.StoryType <> wdMainTextStory Then
> > While Not (oStory.NextStoryRange Is Nothing)
> > Set oStory = oStory.NextStoryRange
> > oStory.Fields.Update
> > Wend
> > End If
> > Next oStory
> > Set oStory = Nothing
> >
> > Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
> >
> > End Sub
> >
> > Thanks for looking at this.
> > Jeanmac
>
>
>

Re: Error whilst fields are updating by Charles

Charles
Thu Sep 22 21:41:40 CDT 2005

Also, you do not have access to any of the headers and footers, even in
unprotected sections, when part of the document is protected for forms.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Jezebel" <warcrimes@whitehouse.gov> wrote in message
news:%23hHo$10vFHA.2064@TK2MSFTNGP09.phx.gbl...
> Only in the protected section. The rest is fine. Designing the document
> around that constraint is a hell of a lot easier than running macros on
> other people's computers.
>
>
> "jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
> news:9E95BAA1-4A22-4AC3-997B-5E04E3577144@microsoft.com...
>> As far as I am aware,when part of a document is protected, you can't do
>> some
>> things like formatting bullets and numbers, restart numbering, continue
>> numbering and other things. It would be great if you know of a way of
>> that
>> not happening.
>>
>> "Jezebel" wrote:
>>
>>> What reduced functionality? You need protect only the *sections*
>>> containing
>>> the fields: the other sections can be unprotected and fully functional.
>>>
>>>
>>>
>>>
>>> "jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
>>> news:03A54D15-5A38-45B9-B007-429A15D5ED22@microsoft.com...
>>> > Trouble is if I do that the document is protected and has reduced
>>> > functionality which is not what the users want. The reason why I used
>>> > ASK
>>> > fields is because the bookmark is inserted twice to update information
>>> > in
>>> > the
>>> > footer and on the back page of the document. Hence the reason for
>>> > wanting
>>> > to
>>> > know if I can do anything with the bookmarks when the document first
>>> > opens.
>>> >
>>> > "Jezebel" wrote:
>>> >
>>> >> Why not use ordinary form fields? Then you wouldn't need the macro or
>>> >> the
>>> >> updating at all... Break the document into sections, and protect only
>>> >> the
>>> >> sections containing the fields.
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> "jeanmac" <jeanmac@discussions.microsoft.com> wrote in message
>>> >> news:E81D52A8-0651-43EE-B8CC-81E1554057CF@microsoft.com...
>>> >> >I have designed a report template using ASK fields (the report
>>> >> >cannot be
>>> >> > protected and tables are not practical). A macro placed in the
>>> >> > ThisDocument
>>> >> > module prompts the ASK fields and it all works beautifully except
>>> >> > that
>>> >> > whilst
>>> >> > the prompts for the ASK fields are on screen you can see the
>>> >> > document
>>> >> > behind
>>> >> > and where the bookmark for the ASK fields are it displays "Error
>>> >> > Bookmark
>>> >> > not
>>> >> > Defined" - however when they are all filled in the error disappears
>>> >> > and
>>> >> > the
>>> >> > data that was typed in the boxes appears in the correct fields, but
>>> >> > I
>>> >> > can't
>>> >> > have users seeing the error messages it would confuse them.
>>> >> >
>>> >> > I have tried all sorts of ways but cannot find how to hide the
>>> >> > window
>>> >> > whilst
>>> >> > the fields are updating. I've tried Application.ScreenUpdating =
>>> >> > False,
>>> >> > but
>>> >> > it didn't work. Anyone have an idea?
>>> >> >
>>> >> > The code is:
>>> >> >
>>> >> > Sub AutoNew()
>>> >> >
>>> >> > Dim oStory As Range
>>> >> >
>>> >> > For Each oStory In ActiveDocument.StoryRanges
>>> >> > oStory.Fields.Update
>>> >> > If oStory.StoryType <> wdMainTextStory Then
>>> >> > While Not (oStory.NextStoryRange Is Nothing)
>>> >> > Set oStory = oStory.NextStoryRange
>>> >> > oStory.Fields.Update
>>> >> > Wend
>>> >> > End If
>>> >> > Next oStory
>>> >> > Set oStory = Nothing
>>> >> >
>>> >> > Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
>>> >> >
>>> >> > End Sub
>>> >> >
>>> >> > Thanks for looking at this.
>>> >> > Jeanmac
>>> >>
>>> >>
>>> >>
>>>
>>>
>>>
>
>



Re: Error whilst fields are updating by slicknick

slicknick
Fri Oct 28 05:29:01 CDT 2005

Hi jeanmac and macropod,

I've got the same problem in wanting to use ASK fields to obtain data when a
document template opens. I've created the ASK fields to store the input and
REF fields to use the values returned in multiple places within the document.
My problem is that I'm not prompted by the ASK fields when the document
opens. I've checked to see if I have any values specified for the ASK
variables by looking on Insert/Bookmark.. and there's nothing. Is there
something else I need to do to get the ASK fields to prompt me when the
document opens? All I see for me REF entries now is "ERROR! Reference source
not found."

TIA


"jeanmac" wrote:

> Thanks macropod! I got round it in the end by giving a default of an empty
> text string to all the fields, but that's a bit excessive, your solution is
> much better.
>
> "macropod" wrote:
>
> > Hi jeanmac,
> >
> > The *really* simple solution is to insert the bookmarks created/maintained
> > by the ASK fields into your template manually. For example, say you have a
> > field:
> > {ASK Age "How old are you?"}
> > Position the cursor immediately before this field, with nothing selected,
> > and use Insert|Bookmark to insert an 'Age' bookmark at that point. In fact,
> > you can insert these anywhere in the template, but next to the fields is
> > handy.
> >
> > Do this with all of the fields but DON'T UPDATE THEM before saving the
> > template. If you do, you'll have to repeat the above process.
> >
> > Now, when the template is opened, you won't get the "Error Bookmark not
> > Defined" message, but the required prompts will occur.
> >
> > Cheers

Re: Error whilst fields are updating by jeanmac

jeanmac
Fri Oct 28 05:55:05 CDT 2005

Hi Slicknick

In addition to writing the ASK fields, after a lot of help from the people
on this site (thankyou all), I found that I had to put a macro in the This
Document module of the template. To get to it, in the template, click on the
Tools menu, select Macro then Visual Basic Editor.

On the left of the Visual Basic Editor there is a Project Explorer window
and you will see something like Project (Template #), under the folder
Micrososft Word Objects you will see a template symbol labelled ThisDocument.
Double directly on the template symbol to open the module window for
ThisDocument and paste in the following code:

Sub AutoNew()

Dim oStory As Range

For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing

Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"

End Sub

Resave the template. Hope that works, it did for me.

Cheers
Jeanmac

"slicknick" wrote:

> Hi jeanmac and macropod,
>
> I've got the same problem in wanting to use ASK fields to obtain data when a
> document template opens. I've created the ASK fields to store the input and
> REF fields to use the values returned in multiple places within the document.
> My problem is that I'm not prompted by the ASK fields when the document
> opens. I've checked to see if I have any values specified for the ASK
> variables by looking on Insert/Bookmark.. and there's nothing. Is there
> something else I need to do to get the ASK fields to prompt me when the
> document opens? All I see for me REF entries now is "ERROR! Reference source
> not found."
>
> TIA
>
>
> "jeanmac" wrote:
>
> > Thanks macropod! I got round it in the end by giving a default of an empty
> > text string to all the fields, but that's a bit excessive, your solution is
> > much better.
> >
> > "macropod" wrote:
> >
> > > Hi jeanmac,
> > >
> > > The *really* simple solution is to insert the bookmarks created/maintained
> > > by the ASK fields into your template manually. For example, say you have a
> > > field:
> > > {ASK Age "How old are you?"}
> > > Position the cursor immediately before this field, with nothing selected,
> > > and use Insert|Bookmark to insert an 'Age' bookmark at that point. In fact,
> > > you can insert these anywhere in the template, but next to the fields is
> > > handy.
> > >
> > > Do this with all of the fields but DON'T UPDATE THEM before saving the
> > > template. If you do, you'll have to repeat the above process.
> > >
> > > Now, when the template is opened, you won't get the "Error Bookmark not
> > > Defined" message, but the required prompts will occur.
> > >
> > > Cheers

Re: Error whilst fields are updating by slicknick

slicknick
Fri Oct 28 06:29:02 CDT 2005

Jeanmac,

thanks for a very prompt response.

that certainly had an impact. I get a prompt now for one of the ASK fields I
have but not the others for some reason. I then get a MS Word error message
saying 'The bookmark does not exists' and that is followed by a VB error
saying the same thing. I know absolutely nothings about the language
structure for VB but I suspect that the code that you gave me may relate to
individual ASK fields in your document. If that's the case, can you tell me
which bits I need to change.

TIA (again!)

"jeanmac" wrote:

> Hi Slicknick
>
> In addition to writing the ASK fields, after a lot of help from the people
> on this site (thankyou all), I found that I had to put a macro in the This
> Document module of the template. To get to it, in the template, click on the
> Tools menu, select Macro then Visual Basic Editor.
>
> On the left of the Visual Basic Editor there is a Project Explorer window
> and you will see something like Project (Template #), under the folder
> Micrososft Word Objects you will see a template symbol labelled ThisDocument.
> Double directly on the template symbol to open the module window for
> ThisDocument and paste in the following code:
>
> Sub AutoNew()
>
> Dim oStory As Range
>
> For Each oStory In ActiveDocument.StoryRanges
> oStory.Fields.Update
> If oStory.StoryType <> wdMainTextStory Then
> While Not (oStory.NextStoryRange Is Nothing)
> Set oStory = oStory.NextStoryRange
> oStory.Fields.Update
> Wend
> End If
> Next oStory
> Set oStory = Nothing
>
> Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
>
> End Sub
>
> Resave the template. Hope that works, it did for me.
>
> Cheers
> Jeanmac

Re: Error whilst fields are updating by jeanmac

jeanmac
Fri Oct 28 06:57:03 CDT 2005

Hi

It may be that the problem is in the Ref fields. I didn't create Ref fields
where I wanted the ASK field to repeat. What I did was place the cursor
where I wanted the field to repeat and press Ctrl+F9 to create the field
placemark {}, then I typed the ASK bookmark between them, eg if the ASK Field
prompts

{ ASK Country â??Type the required countryâ?? \d â?? â?? \* MERGEFORMAT }

The bookmark is Country. So at each place where you want the field repeated
type Ctrl+F9 to create the field placemark and then type the bookmark exactly
as it appears in the ASK field, eg {Country}. Press Alt+F9 to reveal/hide
the ASK field codes and then you can copy it directly from the field.

Hope that helps.

Cheers
Jeanmac

"slicknick" wrote:

> Jeanmac,
>
> thanks for a very prompt response.
>
> that certainly had an impact. I get a prompt now for one of the ASK fields I
> have but not the others for some reason. I then get a MS Word error message
> saying 'The bookmark does not exists' and that is followed by a VB error
> saying the same thing. I know absolutely nothings about the language
> structure for VB but I suspect that the code that you gave me may relate to
> individual ASK fields in your document. If that's the case, can you tell me
> which bits I need to change.
>
> TIA (again!)
>
> "jeanmac" wrote:
>
> > Hi Slicknick
> >
> > In addition to writing the ASK fields, after a lot of help from the people
> > on this site (thankyou all), I found that I had to put a macro in the This
> > Document module of the template. To get to it, in the template, click on the
> > Tools menu, select Macro then Visual Basic Editor.
> >
> > On the left of the Visual Basic Editor there is a Project Explorer window
> > and you will see something like Project (Template #), under the folder
> > Micrososft Word Objects you will see a template symbol labelled ThisDocument.
> > Double directly on the template symbol to open the module window for
> > ThisDocument and paste in the following code:
> >
> > Sub AutoNew()
> >
> > Dim oStory As Range
> >
> > For Each oStory In ActiveDocument.StoryRanges
> > oStory.Fields.Update
> > If oStory.StoryType <> wdMainTextStory Then
> > While Not (oStory.NextStoryRange Is Nothing)
> > Set oStory = oStory.NextStoryRange
> > oStory.Fields.Update
> > Wend
> > End If
> > Next oStory
> > Set oStory = Nothing
> >
> > Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
> >
> > End Sub
> >
> > Resave the template. Hope that works, it did for me.
> >
> > Cheers
> > Jeanmac

Re: Error whilst fields are updating by slicknick

slicknick
Fri Oct 28 07:32:02 CDT 2005

Hi,

My ASK fields look OK and I've changed the places where I want the bookmarks
to be repeated so they don't use REF fields (although the MS Word Help seems
to indicate that is the way to do it). I want a value entered in the document
header on the first page and then that same value used elsewhere in the
document. So, the first time I want the value printed I also ASK for it:

{ ASK Machine_Type "Machine type booked/supplied?" \d ""}{ Machine_Type }

and then further on in the document I just have:

{ Machine_Type }

I still get the same problem 'Bookmark not found' errors using the VB code
you supplied. Do I need to change that at all for my bookmark names? If so,
which bits.

Thanks.

"jeanmac" wrote:

> Hi
>
> It may be that the problem is in the Ref fields. I didn't create Ref fields
> where I wanted the ASK field to repeat. What I did was place the cursor
> where I wanted the field to repeat and press Ctrl+F9 to create the field
> placemark {}, then I typed the ASK bookmark between them, eg if the ASK Field
> prompts
>
> { ASK Country â??Type the required countryâ?? \d â?? â?? \* MERGEFORMAT }
>
> The bookmark is Country. So at each place where you want the field repeated
> type Ctrl+F9 to create the field placemark and then type the bookmark exactly
> as it appears in the ASK field, eg {Country}. Press Alt+F9 to reveal/hide
> the ASK field codes and then you can copy it directly from the field.
>
> Hope that helps.
>
> Cheers
> Jeanmac
>
> "slicknick" wrote:
>
> > Jeanmac,
> >
> > thanks for a very prompt response.
> >
> > that certainly had an impact. I get a prompt now for one of the ASK fields I
> > have but not the others for some reason. I then get a MS Word error message
> > saying 'The bookmark does not exists' and that is followed by a VB error
> > saying the same thing. I know absolutely nothings about the language
> > structure for VB but I suspect that the code that you gave me may relate to
> > individual ASK fields in your document. If that's the case, can you tell me
> > which bits I need to change.
> >
> > TIA (again!)
> >
> > "jeanmac" wrote:
> >
> > > Hi Slicknick
> > >
> > > In addition to writing the ASK fields, after a lot of help from the people
> > > on this site (thankyou all), I found that I had to put a macro in the This
> > > Document module of the template. To get to it, in the template, click on the
> > > Tools menu, select Macro then Visual Basic Editor.
> > >
> > > On the left of the Visual Basic Editor there is a Project Explorer window
> > > and you will see something like Project (Template #), under the folder
> > > Micrososft Word Objects you will see a template symbol labelled ThisDocument.
> > > Double directly on the template symbol to open the module window for
> > > ThisDocument and paste in the following code:
> > >
> > > Sub AutoNew()
> > >
> > > Dim oStory As Range
> > >
> > > For Each oStory In ActiveDocument.StoryRanges
> > > oStory.Fields.Update
> > > If oStory.StoryType <> wdMainTextStory Then
> > > While Not (oStory.NextStoryRange Is Nothing)
> > > Set oStory = oStory.NextStoryRange
> > > oStory.Fields.Update
> > > Wend
> > > End If
> > > Next oStory
> > > Set oStory = Nothing
> > >
> > > Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
> > >
> > > End Sub
> > >
> > > Resave the template. Hope that works, it did for me.
> > >
> > > Cheers
> > > Jeanmac

Re: Error whilst fields are updating by jeanmac

jeanmac
Fri Oct 28 07:43:02 CDT 2005

Sorry!!! I've just looked at the code, and the problem is that I had an
extra bookmark and told the code to go to it when it had finished running.
You need to take that line out of the MyDocument code, it is:

Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"

I didn't think and just copied all of the code from my document. Hope this
fixes it for you.

Jeanmac

"slicknick" wrote:

> Hi,
>
> My ASK fields look OK and I've changed the places where I want the bookmarks
> to be repeated so they don't use REF fields (although the MS Word Help seems
> to indicate that is the way to do it). I want a value entered in the document
> header on the first page and then that same value used elsewhere in the
> document. So, the first time I want the value printed I also ASK for it:
>
> { ASK Machine_Type "Machine type booked/supplied?" \d ""}{ Machine_Type }
>
> and then further on in the document I just have:
>
> { Machine_Type }
>
> I still get the same problem 'Bookmark not found' errors using the VB code
> you supplied. Do I need to change that at all for my bookmark names? If so,
> which bits.
>
> Thanks.
>
> "jeanmac" wrote:
>
> > Hi
> >
> > It may be that the problem is in the Ref fields. I didn't create Ref fields
> > where I wanted the ASK field to repeat. What I did was place the cursor
> > where I wanted the field to repeat and press Ctrl+F9 to create the field
> > placemark {}, then I typed the ASK bookmark between them, eg if the ASK Field
> > prompts
> >
> > { ASK Country â??Type the required countryâ?? \d â?? â?? \* MERGEFORMAT }
> >
> > The bookmark is Country. So at each place where you want the field repeated
> > type Ctrl+F9 to create the field placemark and then type the bookmark exactly
> > as it appears in the ASK field, eg {Country}. Press Alt+F9 to reveal/hide
> > the ASK field codes and then you can copy it directly from the field.
> >
> > Hope that helps.
> >
> > Cheers
> > Jeanmac
> >
> > "slicknick" wrote:
> >
> > > Jeanmac,
> > >
> > > thanks for a very prompt response.
> > >
> > > that certainly had an impact. I get a prompt now for one of the ASK fields I
> > > have but not the others for some reason. I then get a MS Word error message
> > > saying 'The bookmark does not exists' and that is followed by a VB error
> > > saying the same thing. I know absolutely nothings about the language
> > > structure for VB but I suspect that the code that you gave me may relate to
> > > individual ASK fields in your document. If that's the case, can you tell me
> > > which bits I need to change.
> > >
> > > TIA (again!)
> > >
> > > "jeanmac" wrote:
> > >
> > > > Hi Slicknick
> > > >
> > > > In addition to writing the ASK fields, after a lot of help from the people
> > > > on this site (thankyou all), I found that I had to put a macro in the This
> > > > Document module of the template. To get to it, in the template, click on the
> > > > Tools menu, select Macro then Visual Basic Editor.
> > > >
> > > > On the left of the Visual Basic Editor there is a Project Explorer window
> > > > and you will see something like Project (Template #), under the folder
> > > > Micrososft Word Objects you will see a template symbol labelled ThisDocument.
> > > > Double directly on the template symbol to open the module window for
> > > > ThisDocument and paste in the following code:
> > > >
> > > > Sub AutoNew()
> > > >
> > > > Dim oStory As Range
> > > >
> > > > For Each oStory In ActiveDocument.StoryRanges
> > > > oStory.Fields.Update
> > > > If oStory.StoryType <> wdMainTextStory Then
> > > > While Not (oStory.NextStoryRange Is Nothing)
> > > > Set oStory = oStory.NextStoryRange
> > > > oStory.Fields.Update
> > > > Wend
> > > > End If
> > > > Next oStory
> > > > Set oStory = Nothing
> > > >
> > > > Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
> > > >
> > > > End Sub
> > > >
> > > > Resave the template. Hope that works, it did for me.
> > > >
> > > > Cheers
> > > > Jeanmac

Re: Error whilst fields are updating by slicknick

slicknick
Fri Oct 28 08:48:10 CDT 2005

OK. I've removed that line of code and that has resolved the 'Bookmark not
found' pop-up errors from Word and VB. The only issues I have now are:

1) I still get an 'ERROR! Bookmark not defined.' error message in the
document for the first reference of the bookmark which happens to be on the
same page (page 1) as the ASK field itself. The second reference to the
bookmark (on page 3) is updated OK.

2) I only get a prompt for the first ASK field in the document. This
obviously then causes 'bookmark not defined' errors later. I've tried varying
the order of the ASK statement and proved that it is just the first one that
is prompted.

Have you any ideas about this?

Thanks.

"jeanmac" wrote:

> Sorry!!! I've just looked at the code, and the problem is that I had an
> extra bookmark and told the code to go to it when it had finished running.
> You need to take that line out of the MyDocument code, it is:
>
> Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
>
> I didn't think and just copied all of the code from my document. Hope this
> fixes it for you.
>
> Jeanmac
>
> "slicknick" wrote:
>
> > Hi,
> >
> > My ASK fields look OK and I've changed the places where I want the bookmarks
> > to be repeated so they don't use REF fields (although the MS Word Help seems
> > to indicate that is the way to do it). I want a value entered in the document
> > header on the first page and then that same value used elsewhere in the
> > document. So, the first time I want the value printed I also ASK for it:
> >
> > { ASK Machine_Type "Machine type booked/supplied?" \d ""}{ Machine_Type }
> >
> > and then further on in the document I just have:
> >
> > { Machine_Type }
> >
> > I still get the same problem 'Bookmark not found' errors using the VB code
> > you supplied. Do I need to change that at all for my bookmark names? If so,
> > which bits.
> >
> > Thanks.
> >
> > "jeanmac" wrote:
> >
> > > Hi
> > >
> > > It may be that the problem is in the Ref fields. I didn't create Ref fields
> > > where I wanted the ASK field to repeat. What I did was place the cursor
> > > where I wanted the field to repeat and press Ctrl+F9 to create the field
> > > placemark {}, then I typed the ASK bookmark between them, eg if the ASK Field
> > > prompts
> > >
> > > { ASK Country â??Type the required countryâ?? \d â?? â?? \* MERGEFORMAT }
> > >
> > > The bookmark is Country. So at each place where you want the field repeated
> > > type Ctrl+F9 to create the field placemark and then type the bookmark exactly
> > > as it appears in the ASK field, eg {Country}. Press Alt+F9 to reveal/hide
> > > the ASK field codes and then you can copy it directly from the field.
> > >
> > > Hope that helps.
> > >
> > > Cheers
> > > Jeanmac
> > >
> > > "slicknick" wrote:
> > >
> > > > Jeanmac,
> > > >
> > > > thanks for a very prompt response.
> > > >
> > > > that certainly had an impact. I get a prompt now for one of the ASK fields I
> > > > have but not the others for some reason. I then get a MS Word error message
> > > > saying 'The bookmark does not exists' and that is followed by a VB error
> > > > saying the same thing. I know absolutely nothings about the language
> > > > structure for VB but I suspect that the code that you gave me may relate to
> > > > individual ASK fields in your document. If that's the case, can you tell me
> > > > which bits I need to change.
> > > >
> > > > TIA (again!)
> > > >
> > > > "jeanmac" wrote:
> > > >
> > > > > Hi Slicknick
> > > > >
> > > > > In addition to writing the ASK fields, after a lot of help from the people
> > > > > on this site (thankyou all), I found that I had to put a macro in the This
> > > > > Document module of the template. To get to it, in the template, click on the
> > > > > Tools menu, select Macro then Visual Basic Editor.
> > > > >
> > > > > On the left of the Visual Basic Editor there is a Project Explorer window
> > > > > and you will see something like Project (Template #), under the folder
> > > > > Micrososft Word Objects you will see a template symbol labelled ThisDocument.
> > > > > Double directly on the template symbol to open the module window for
> > > > > ThisDocument and paste in the following code:
> > > > >
> > > > > Sub AutoNew()
> > > > >
> > > > > Dim oStory As Range
> > > > >
> > > > > For Each oStory In ActiveDocument.StoryRanges
> > > > > oStory.Fields.Update
> > > > > If oStory.StoryType <> wdMainTextStory Then
> > > > > While Not (oStory.NextStoryRange Is Nothing)
> > > > > Set oStory = oStory.NextStoryRange
> > > > > oStory.Fields.Update
> > > > > Wend
> > > > > End If
> > > > > Next oStory
> > > > > Set oStory = Nothing
> > > > >
> > > > > Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
> > > > >
> > > > > End Sub
> > > > >
> > > > > Resave the template. Hope that works, it did for me.
> > > > >
> > > > > Cheers
> > > > > Jeanmac

Re: Error whilst fields are updating by slicknick

slicknick
Fri Oct 28 08:49:12 CDT 2005

OK. I've removed that line of code and that has resolved the 'Bookmark not
found' pop-up errors from Word and VB. The only issues I have now are:

1) I still get an 'ERROR! Bookmark not defined.' error message in the
document for the first reference of the bookmark which happens to be on the
same page (page 1) as the ASK field itself. The second reference to the
bookmark (on page 3) is updated OK.

2) I only get a prompt for the first ASK field in the document. This
obviously then causes 'bookmark not defined' errors later. I've tried varying
the order of the ASK statement and proved that it is just the first one that
is prompted.

Have you any ideas about this?

Thanks.


"jeanmac" wrote:

> Sorry!!! I've just looked at the code, and the problem is that I had an
> extra bookmark and told the code to go to it when it had finished running.
> You need to take that line out of the MyDocument code, it is:
>
> Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
>
> I didn't think and just copied all of the code from my document. Hope this
> fixes it for you.
>
> Jeanmac
>
> "slicknick" wrote:
>
> > Hi,
> >
> > My ASK fields look OK and I've changed the places where I want the bookmarks
> > to be repeated so they don't use REF fields (although the MS Word Help seems
> > to indicate that is the way to do it). I want a value entered in the document
> > header on the first page and then that same value used elsewhere in the
> > document. So, the first time I want the value printed I also ASK for it:
> >
> > { ASK Machine_Type "Machine type booked/supplied?" \d ""}{ Machine_Type }
> >
> > and then further on in the document I just have:
> >
> > { Machine_Type }
> >
> > I still get the same problem 'Bookmark not found' errors using the VB code
> > you supplied. Do I need to change that at all for my bookmark names? If so,
> > which bits.
> >
> > Thanks.
> >
> > "jeanmac" wrote:
> >
> > > Hi
> > >
> > > It may be that the problem is in the Ref fields. I didn't create Ref fields
> > > where I wanted the ASK field to repeat. What I did was place the cursor
> > > where I wanted the field to repeat and press Ctrl+F9 to create the field
> > > placemark {}, then I typed the ASK bookmark between them, eg if the ASK Field
> > > prompts
> > >
> > > { ASK Country â??Type the required countryâ?? \d â?? â?? \* MERGEFORMAT }
> > >
> > > The bookmark is Country. So at each place where you want the field repeated
> > > type Ctrl+F9 to create the field placemark and then type the bookmark exactly
> > > as it appears in the ASK field, eg {Country}. Press Alt+F9 to reveal/hide
> > > the ASK field codes and then you can copy it directly from the field.
> > >
> > > Hope that helps.
> > >
> > > Cheers
> > > Jeanmac
> > >
> > > "slicknick" wrote:
> > >
> > > > Jeanmac,
> > > >
> > > > thanks for a very prompt response.
> > > >
> > > > that certainly had an impact. I get a prompt now for one of the ASK fields I
> > > > have but not the others for some reason. I then get a MS Word error message
> > > > saying 'The bookmark does not exists' and that is followed by a VB error
> > > > saying the same thing. I know absolutely nothings about the language
> > > > structure for VB but I suspect that the code that you gave me may relate to
> > > > individual ASK fields in your document. If that's the case, can you tell me
> > > > which bits I need to change.
> > > >
> > > > TIA (again!)
> > > >
> > > > "jeanmac" wrote:
> > > >
> > > > > Hi Slicknick
> > > > >
> > > > > In addition to writing the ASK fields, after a lot of help from the people
> > > > > on this site (thankyou all), I found that I had to put a macro in the This
> > > > > Document module of the template. To get to it, in the template, click on the
> > > > > Tools menu, select Macro then Visual Basic Editor.
> > > > >
> > > > > On the left of the Visual Basic Editor there is a Project Explorer window
> > > > > and you will see something like Project (Template #), under the folder
> > > > > Micrososft Word Objects you will see a template symbol labelled ThisDocument.
> > > > > Double directly on the template symbol to open the module window for
> > > > > ThisDocument and paste in the following code:
> > > > >
> > > > > Sub AutoNew()
> > > > >
> > > > > Dim oStory As Range
> > > > >
> > > > > For Each oStory In ActiveDocument.StoryRanges
> > > > > oStory.Fields.Update
> > > > > If oStory.StoryType <> wdMainTextStory Then
> > > > > While Not (oStory.NextStoryRange Is Nothing)
> > > > > Set oStory = oStory.NextStoryRange
> > > > > oStory.Fields.Update
> > > > > Wend
> > > > > End If
> > > > > Next oStory
> > > > > Set oStory = Nothing
> > > > >
> > > > > Selection.GoTo What:=wdGoToBookmark, Name:="StartDoc"
> > > > >
> > > > > End Sub
> > > > >
> > > > > Resave the template. Hope that works, it did for me.
> > > > >
> > > > > Cheers
> > > > > Jeanmac

Re: Error whilst fields are updating by jeanmac

jeanmac
Fri Oct 28 09:06:05 CDT 2005

If you only have one actualk ASK field, although there are several references
to the bookmark, you will only have one prompt. Try removing the bookmark
that gives the error message and re-doing it, it may have become corrupt.