none
Rouge List Templates Added when using Organizer Copy RRS feed

  • Question

  • Hi

    We are preparing for our rollout of Word 2010 and hit a problem.  I am trying to create a macro to copy styles from our Normal Template into documents which don't already contain our standard styles.  Our standard styles in the Normal template are linked to List Templates which are explicitly named in the "ListNum field list name" field in the Multilevel list. Screenshot of Multilevel List below.

    We are using the code below to copy the styles (we are using an array to specify which styles to copy) to the document, however when this happens we are finding that additional List Templates are being created with blank names.

    For Each styleLoop In allStylesArray

            Application.OrganizerCopy Source:=normalLocation, _

                Destination:=ActiveDocument.FullName, _

                Name:=styleLoop, _

                Object:=wdOrganizerObjectStyles

    Next styleLoop

    We also tried the code below with the same result:

    ActiveDocument.CopyStylesFromTemplate Template:=normalLocation

    We have tried importing the List Templates before we carry out the Style Copy but we still get these additional List Templates being created.

    I would have expected that the organizer copy would either bring in the whole list template including the name, or if the list template already existed not bring in the list template at all. Instead it just brings in a copy of the list template without its identity.

    This means that we are ending up with additional unidentifiable list templates in the document.  Is it possible to copy styles from a template to a document either without any list template, or have the full details of the list template brought in including the list template name.

    Alternatively does anybody have a reliable way to copy Styles and List Templates fomr a Template to a Document without bloating the target document?

    Any help appreciated.

    Regards

    Jon



    • Edited by JMS-BR Friday, June 1, 2012 4:10 PM
    Friday, June 1, 2012 10:06 AM

All replies

  • Hi Jon,

    How do you set the value for the array allStylesArray ?

    Check the document:

    http://msdn.microsoft.com/en-us/library/bb221402%28v=office.12%29.aspx

    Dim atEntry As AutoTextEntry
    
    For Each atEntry In _
            ActiveDocument.AttachedTemplate.AutoTextEntries
        Application.OrganizerCopy _
            Source:=ActiveDocument.AttachedTemplate.FullName, _
            Destination:=NormalTemplate.FullName, Name:=atEntry.Name, _
            Object:=wdOrganizerObjectAutoText
    Next atEntry
    Thanks.
    Monday, June 4, 2012 9:36 AM
  • Hi

    Thanks for your response.  We set the value for the allStylesArray as below.  We don't think it is a problem with the array as if we use ActiveDocument.CopyStylesFromTemplate (i.e. copy all styles from Normal.dot) we get the same result (we use the Organizeer copy as we want to specifiy the styles to copy)

    Another interesting quirk is that 2 of the 8 List Templates that are attached to the Styles actually come through and retain the List Template Name where as the other 6 come through with blank template names.

    Regards

    Jon

    Public Sub AllStyles()

    allStylesArray = Array("Cover Date", "Cover Party Name", "Cover Document Title", _

                   "Cover Document Description", "Cover Text", "TOC Heading", _

                   "ToC Sub Heading", "Intro Heading", "Parties 1", "Parties 2", _

                   "Background 1", "Background 2", "Body Text", "Level 1 Heading", _

                   "Level 1 Number", "Body Text 1", "Level 2 Heading", "Level 2 Number", _

                   "Body Text 2", "Level 3 Heading", "Level 3 Number", "Body Text 3", _

                   "Level 4 Heading", "Level 4 Number", "Body Text 4", "Level 5 Heading", _

                   "Level 5 Number", "Body Text 5", "Definition Term", "Definition", _

                   "Schedule", "Part", "Sch 1 Heading", "Sch 1 Number", "Sch 2 Heading", _

                   "Sch 2 Number", "Sch 3 Heading", "Sch 3 Number", "Sch 4 Heading", _

                   "Sch 4 Number", "Sch 5 Heading", "Sch 5 Number", "Appendix", _

                   "Execution", "Will Heading 1", "Will Body 1", _

                   "Will Heading 2", "Will Body 2", "Will Heading 3", "Will Body 3", _

                   "Will Heading 4", "Will Body 4", "Will Heading 5", "Will Body 5", _

                   "Will Normal", "Wit Stat Level 1", "Wit Stat Body 1", "Wit Stat Level 2", _

                   "Wit Stat Body 2", "Wit Stat Level 3", "Wit Stat Body 3")

    End Sub

    Wednesday, June 6, 2012 9:50 AM