Results 1 to 11 of 11
  1. #1
    New Lounger
    Join Date
    Mar 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello,

    I'm using this solution ([topic="670027"]Relative Paths in Word Fields[/topic]) for creating headers and footers for Specifications. I have a document called HeaderData.doc and one called FooterData.doc. Using the method described in the initial post, I have inserted the following fields:
    {INCLUDETEXT "{FILENAME \p}\\..\\..\\FooterData.doc" \* MERGEFORMAT } for the footer
    {INCLUDETEXT "{FILENAME \p}\\..\\..\\HeaderData.doc" \* MERGEFORMAT } for the header

    This successfully finds the files that are up one folder level. However, to get them to update, I have to do it manually. I have tried your Code Module to try to get them to update, but that doesn't seem to work. I have enabled the code, but it does not update the text.

    My hope was to be able to change the text in the HeaderData and FooterData file, select all the relevant files and print them, and the correct headers and footers would be present. Should that be possible using this method?

    Also, the formatting does not seem to carry over correctly from the HeaderData and FooterData files to the target file. Should it carry over?

    Thanks

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by TheGoodOmen' post='766721 View Post
    Also, the formatting does not seem to carry over correctly from the HeaderData and FooterData files to the target file. Should it carry over?
    Hmmm, what kind of formatting? The INCLUDETEXT field is subject to the style definitions in the "receiving" file, because you can only have one "Normal", for example.

  3. #3
    New Lounger
    Join Date
    Mar 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='jscher2000' post='766726' date='22-Mar-2009 15:49']Do you have the checkbox checked (pre-2007:Tools>Options>Print; 2007:Office>Word Options>Display) to update fields when printing?


    Hmmm, what kind of formatting? The INCLUDETEXT field is subject to the style definitions in the "receiving" file, because you can only have one "Normal", for example.[/quote]


    Yes, the checkbox is checked. I have verified that when I print that the text does not update.

    The formatting is that certain words are in bold.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    [quote name='TheGoodOmen' post='767659' date='26-Mar-2009 13:36']Yes, the checkbox is checked. I have verified that when I print that the text does not update.[/quote]
    Normally, fields in the header and footer do update automatically when you print or preview, and the checkbox applies that behavior to the body. Is it possible that INCLUDETEXT fields are an exception? Many years ago there was a security issue with INCLUDETEXT fields, and Microsoft patched Word to make them a little less automatic. You can read about that here: How the behavior of the Word fields changes after you install the Word update (MSKB 330079). Maybe that behavior was baked into more recent versions so that you have to write some VBA code to update the fields, rather than relying on Word to do it automatically.

    Regarding the formatting, when I use INCLUDETEXT fields in the body, direct formatting such as bold, font size, and font color are preserved. I haven't tested in the header/footer because I don't have a suitably small document handy.

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    [quote name='TheGoodOmen' post='766721' date='23-Mar-2009 07:34']Hello,

    I'm using this solution ([topic="670027"]Relative Paths in Word Fields[/topic]) for creating headers and footers for Specifications. I have a document called HeaderData.doc and one called FooterData.doc. Using the method described in the initial post, I have inserted the following fields:
    {INCLUDETEXT "{FILENAME \p}\\..\\..\\FooterData.doc" \* MERGEFORMAT } for the footer
    {INCLUDETEXT "{FILENAME \p}\\..\\..\\HeaderData.doc" \* MERGEFORMAT } for the header

    This successfully finds the files that are up one folder level. However, to get them to update, I have to do it manually. I have tried your Code Module to try to get them to update, but that doesn't seem to work. I have enabled the code, but it does not update the text.

    My hope was to be able to change the text in the HeaderData and FooterData file, select all the relevant files and print them, and the correct headers and footers would be present. Should that be possible using this method?

    Also, the formatting does not seem to carry over correctly from the HeaderData and FooterData files to the target file. Should it carry over?

    Thanks[/quote]
    Hi TheGoodOmen,

    You'd probably do well to delete the \* MERGEFORMAT switches - they're unlikely to do anything useful and could actually make things go awry in some cases.

    As for the code module - that's not intended to be used with the field coding - it's and either/or proposition.

    To ensure the links are updating correctly, make sure you have the 'Update automatic links at Open' option checked (Tools|Options|General). It might also be useful to ensure the 'Update fields' option is checked under Tools|Options|Print.

    As for the formatting, that is largely governed by the Style definitions in the target document. basically, Style definitions in the target document take precedence. If you want to preserve the formating that's present in the source document, give the source material Style names that don't otherwise exist in the target documents.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  6. #6
    New Lounger
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    We're experiencing this problem with headers in Word 2003 as well. Our coding is almost identical to TheGoodOmen's. I've selected all the appropriate check boxes to no avail. The links manager indicates that this link updates manually. Any further suggestions?

  7. #7
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    [quote name='PGor' post='775245' date='15-May-2009 06:06']We're experiencing this problem with headers in Word 2003 as well. Our coding is almost identical to TheGoodOmen's. I've selected all the appropriate check boxes to no avail. The links manager indicates that this link updates manually. Any further suggestions?[/quote]
    Hi PGor,

    Welcome to the Lounge.

    Are all the field braces in your field coding created via Ctrl-F9? And is the file-path & name code enclosed in double quotes? If so and you're still having problems, perhaps you could post stripped-down copies of the two documents in a zip file?
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  8. #8
    New Lounger
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm experiencing the same problem as others, where the header links are not updating automatically on open (or, presumably, on print). Also, macropod's file path updater from here: http://www.wopr.com/index.php?showtopic=670027&st=20, also doesn't seem to update the header link paths. Everything in the body seems to work fine.

    Per macropod's request to PGor, all of the link curly-braces are generated by Word (Alt->Insert->Link), and everything is in double-quotes.

    I'm finding this problem on Word 2000 and Word 2003, both on Win XP.

    Sample files are attached. All three source files (_Header Info, _Reference Standards, _Related Sections) get linked to by dozens of files similar to this example target file. Any help is appreciated.

    As an aside, I know very little about VB coding. Would anyone have a suggestion for how to turn the _Header Info.doc bookmarks into form fields, so that I don't have to worry about users breaking the bookmarks all the time?
    Attached Files Attached Files

  9. #9
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    [quote name='macfisto' post='798204' date='16-Oct-2009 05:57']I'm experiencing the same problem as others, where the header links are not updating automatically on open (or, presumably, on print). Also, macropod's file path updater from here: http://www.wopr.com/index.php?showtopic=670027&st=20, also doesn't seem to update the header link paths. Everything in the body seems to work fine.

    Per macropod's request to PGor, all of the link curly-braces are generated by Word (Alt->Insert->Link), and everything is in double-quotes.

    I'm finding this problem on Word 2000 and Word 2003, both on Win XP.

    Sample files are attached. All three source files (_Header Info, _Reference Standards, _Related Sections) get linked to by dozens of files similar to this example target file. Any help is appreciated.

    As an aside, I know very little about VB coding. Would anyone have a suggestion for how to turn the _Header Info.doc bookmarks into form fields, so that I don't have to worry about users breaking the bookmarks all the time?[/quote]
    hi macfisto,

    The only document with any fields codes in your attachments was the last one, with lots of INCLUDETEXT fields coded like:
    { INCLUDETEXT "H:\\My Documents\\Specs\\SPEC TEMPLATES 2009\\Finished Sections\\_Related Sections.doc" s002100 }
    I can't see any indication of an attempt to modify these for the use of relative paths. If they had been, they'd look more like:
    { INCLUDETEXT "{FILENAME \p}\\..\\_Related Sections.doc" s002100 }

    As for the macro, you shouldn't ordinarily expect to see any changes in the document. That's because the macro is not coded to update what the field displays, but only to maintain the integrity of the links to the external files - when they're all moved around as a group. If you want to refresh the field display, you could add:
    .Update
    after the line:
    .Code.Text = Replace(.Code.Text, OldPath, NewPath)
    but you might then find the code runs much slower.

    Note: the macro code does indeed loop through the headers (and footers). If you're using Word 2007, however, and the first Section's header in a document is completely empty, nothing in any of the other headers will be found - same for footers. That's because of a bug in Word 2007. A simple workaround is to make sure there's at least a single space in the first Section's headers & footers.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  10. #10
    New Lounger
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wacky.

    When I was at the office today, the macro was failing to update the links in the headers. The same files at home tonight? The headers did update. Word 2000 at the office, Word 2003 at home. I'll have to experiment some more and see if I can repeat the problem. I did most of my testing at home, and naturally only found out that it wasn't working at the office when I tried to show it off to some co-workers. They weren't impressed.

    FWIW, I never expected the macro code to make the INCLUDETEXT links relative - it's my very limited understanding that Word just doesn't play nice with relative links. When it's working properly, the macro does what I need it to do, namely, change the absolute paths links to match the current directory.

    For example, the links at the office were as you found them:
    { INCLUDETEXT "H:\\My Documents\\Specs\\SPEC TEMPLATES 2009\\Finished Sections\\_Related Sections.doc" s002100 }
    When I open the same file at home, with macros enabled, I get this:
    { INCLUDETEXT "C:\\Documents and Settings\\macfisto\\My Documents\\Specs\\SPEC TEMPLATES 2009\\Finished Sections\\_Related Sections.doc" s002100 }
    All of the links still work when I update them.

    The intention is that the multiple spec files, including the 3 source files, will be templates. Whenever a new project is started, the needed files will be copied from the template directory to the new project directory, including the 3 source files. Only the _Header Info.doc file needs to be changed by the user, and I'll have to teach everybody how to preserve the bookmarks.

    So:
    1. Any ideas why the header links weren't updating in Word 2000?
    2. Any ideas on how to make _Header Info.doc editable without clueless users wrecking the bookmarks?

    Thanks.

  11. #11
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Hi macfisto,

    I have no idea why the code might not have worked for you with Word 2000 - that's the platform I developed it on!

    You really can't make the bookmarks any more robust in your '_Header Info.doc', but you could add a Document_Close macro to the file to explicity reapply the desired bookmarks to the relevant cell contents (not the whole cells).

    As for implementing relative paths in the field coding, unless you've done it the way I described, it wouldn't work. Some users believe omitting some or all of the path from the field code makes it relative, but that course doesn't work.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •