Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Autotext & document property fields (Word97/2000/...)

    Hi,

    I have a problem with footers in my documents. The scenario is as follows:

    1. I have a template that contains lots of CUSTOM DOCUMENT PROPERTY fields.
    2. The header contains Page number and the chapter heading. (which are both highlighted)
    3. The footer contains various DOCPROPERTY fields (such as Version, filename, titles of the document, etc). This fields are all HIGHLIGHTED.

    Now, I have found that some users have somehow managed to delete the headers & footers totally and therefore I need to replace these with the standard headers & footers as described above. I saved these headers and footers as Autotext entries in the template (open headers/footers, select all, insert autotext).

    I run a macro in the background replacing each header/footer in the section with the AUTOTEXT entries. What I found is that the headers is correctly formatted (i.e. bold text) but the footer is all non-bold (i.e. the DOCPROPERTY fields). It is correctly formatted in terms of font size, spacing etc. It has LOST the BOLD bit for the DOCPROPERTY fields.

    So, firstly why does it lose that & secondly how can make sure that the DOCPROPERTY field is set to BOLD when I insert it from the autotext entry. The code I use is as follows:

    Edited by HansV to move long code fragment to attachment

    Hope all this helps. Thanks in advance for any help - which I am sure you guys will come up with something.

    BTW: How do include spaces in the post. As you can see my macro is not correctly spaced (everything is aligned left)!

    Robie
    Attached Files Attached Files
    Thanks.
    Robie

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Autotext & document property fields (Word97/2000/...)

    If you want to post a long piece of code, it's best to put it in a text file as an attachment. This makes the thread load faster for Loungers who don't want to read all the code, and it preserves indentation too.

    You can preserve indentation in shorter code fragments in the post iself by putting <!t>[pre]<!/t> before and <!t>[/pre]<!/t> after it. You can type these tags yourself or insert them from the 1-Click TagPanel. See <!help=19>Help 19<!/help> for more info.

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Autotext & document property fields (Word97/2000/...)

    My apologies to you and all.

    Will be more careful in the future.

    Robie
    Thanks.
    Robie

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Autotext & document property fields (Word97/2000/...)

    No need to apologize, I didn't mean to tick you off. I just wanted to point out the best way for future posts.

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Autotext & document property fields (Word97/20

    There is a parameter with the Insert method, I believe, to preserve formatting that was saved into the AutoText. It might be RichText:=True. Try adding that to your code, even in the header. The fact that it works in the header might be a coincidence based on the presence of bold formatting at the point of insertion, rather than a sign that Word is inconsistent. Although sometimes Word is inconsistent. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  6. #6
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Autotext & document property fields (Word97/20

    Along the lines of Jefferson's suggestion, can you try modifying the code fragments to include the RichText setting
    <pre> ActiveDocument.AttachedTemplate.AutoTextEntries("r b_EvenPageHeader").Insert _
    Where:=Selection.Range</pre>

    becomes
    <pre> ActiveDocument.AttachedTemplate.AutoTextEntries("r b_EvenPageHeader").Insert _
    Where:=Selection.Range, RichText:=True</pre>

    I would also question whether there is more than one paragraph in your Autotext entries because the code you are using will only apply a style to the last line of the autotext if there is no paragraph mark included at the end of the Autotext entry. You might get more mileage applying the style to the header/footer after the autotext has been inserted.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  7. #7
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Autotext & document property fields (Word97/2000/...)

    Thanks Hans, Jefferson & Andrew. Your suggestion works like a treat. <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23> I looked at the help for the 'Insert' command but somehow (I guess I need to see an optician) missed the Richtext parameter (D'oh).

    You guys are just great. Thanks once again. Robie.
    Thanks.
    Robie

Posting Permissions

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