Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Levin, Manawatu-Wanganui, New Zealand
    Posts
    324
    Thanks
    9
    Thanked 28 Times in 26 Posts

    Attached template style list (Word2k)

    Greeting and happy new year to all
    I am trying to list all styles in activedocument.attachedtemplate without opening and closing the template. Is this possible ?

    I am comparing styles in use in activedocument against a list of styles in a reconstructed version of the desired template. Original template got all mussed up.
    I have built a form with a list of box that I can populate with the styles in use in the active document. Using this tool I can select multiple styles and tell word to reformat all paragraphs formatted with this list with a nominated "good" style.

    I was hoping to be able to similarly list in a listbox the styles available in the template (like the style organiser).
    It appears that I cant do this without temporarily opening the template, iterating through the style list and then closing the template. Is this correct

    Regards
    Geof

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

    Re: Attached template style list (Word2k)

    According to the Help file with Word 2000 that is the only way to do it.
    Remarks
    The Styles object isn't available from the Template object. However, you can use the OpenAsDocument method to open a template as a document so that you can modify styles in the template. The following example changes the formatting of the Heading 1 style in the template attached to the active document.

    Set aDoc = ActiveDocument.AttachedTemplate.OpenAsDocument
    With aDoc
    .Styles(wdStyleHeading1).Font.Name = "Arial"
    .Close SaveChanges:=wdSaveChanges
    End With
    Use the OrganizerCopy method to copy styles between documents and templates. Use the UpdateStyles method to update the styles in the active document to match the style definitions in the attached template.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Levin, Manawatu-Wanganui, New Zealand
    Posts
    324
    Thanks
    9
    Thanked 28 Times in 26 Posts

    Re: Attached template style list (Word2k)

    Hi Andrew
    Many thanks for your assistance.
    Cheers
    Geof

  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

    Re: Attached template style list (Word2k)

    This thread over on the VB/VBA board might or might not add anything to your project...

Posting Permissions

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