• Attached template style list (Word2k)

    Author
    Topic
    #381547

    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

    Viewing 1 reply thread
    Author
    Replies
    • #643723

      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.

    • #644141

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

    Viewing 1 reply thread
    Reply To: Attached template style list (Word2k)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: