I am trying to update docvariables in a word document from Access. This code
will update the variables on the second page but does not update the variable
on the first page - when I am in the footer it is labeled "section1"... Why
is this not working??
If (strApproval) = "Yes" Then
'edits and updates footer field for docname
oDoc.Variables("TCSName").Value = strName
oDoc.Variables("FirstVersion").Value = strVersion
oDoc.Variables("FVersion").Value = strVersion
oDoc.Sections(1).Footers(wdHeaderFooterPrimary).Range.Fields.Update
'sets default path
oApp.Options.DefaultFilePath(wdDocumentsPath) = "C:\"
oApp.ActiveDocument.Save
oApp.Quit
Set oDoc = Nothing
Set oApp = Nothing
GoTo Exit1:
End If
Chances are your document section is set for a different first page
header/footer. If so, you are only changing the continuation footer. Try
something like:
oDoc.StoryRanges(wdFirstPageFooterStory).Fields.Update
WARNING: docvariable fields in Word 97 in the header or footer cause the
program to crash.
See the Fields links at http://addbalance.com/word/wordwebreferences.htm for
a link to a macro that updates all fields in a document, regardless of which
storyrange the field may be found in.

Signature
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.
>I am trying to update docvariables in a word document from Access. This
>code
[quoted text clipped - 18 lines]
> GoTo Exit1:
> End If
btmcfadden@msn.com - 29 Nov 2004 19:55 GMT
Thank you, I'll try that! Now, forgive my ignorance please! But, when you
say my document section is set for a different first page, how would that
have been done? I have a different footer on the first page vs. the
continuing - is that what you mean?! Sorry, obviously, I'm learning
(always!)!!!
THANKS!!!!!
> Chances are your document section is set for a different first page
> header/footer. If so, you are only changing the continuation footer. Try
[quoted text clipped - 30 lines]
> > GoTo Exit1:
> > End If
TRM - 29 Nov 2004 19:59 GMT
Thanks, I'll try that! However, for future reference... when you say the
document section is set for a different first page, would that be because I
have set the first page footer one way and then a different footer for
following pages?? Is that what you are referring to? If it's not, I don't
know why it would be set differently and would love to have more information
on that! Actually, even if that is it, I guess I'm not sure why the first
page wouldn't still be considered the section 1 or the primary page... as
code would imply!? Sorry - forgive my ignorance please! Obviously I'm
learning (all the time!).
Thanks so much for your time and help!
> Chances are your document section is set for a different first page
> header/footer. If so, you are only changing the continuation footer. Try
[quoted text clipped - 30 lines]
> > GoTo Exit1:
> > End If
TRM - 29 Nov 2004 20:19 GMT
Thanks, this worked! Still don't quite understand why... if you have
reference materials/articles, one this particular thing, please note them!
THANKS again!
> Chances are your document section is set for a different first page
> header/footer. If so, you are only changing the continuation footer. Try
[quoted text clipped - 30 lines]
> > GoTo Exit1:
> > End If
Charles Kenyon - 30 Nov 2004 00:16 GMT
See http://addbalance.com/usersguide/sections.htm.

Signature
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.
> Thanks, this worked! Still don't quite understand why... if you have
> reference materials/articles, one this particular thing, please note them!
[quoted text clipped - 37 lines]
>> > GoTo Exit1:
>> > End If