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 / November 2004

Tip: Looking for answers? Try searching our database.

cannot update footer docvariable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
btmcfadden@msn.com - 29 Nov 2004 19:19 GMT
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
Charles Kenyon - 29 Nov 2004 19:42 GMT
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

Rate this thread:






 
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.