• LinkToListTemplate Error (VBA Word 2000)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » LinkToListTemplate Error (VBA Word 2000)

    Author
    Topic
    #372708

    I am creating a macro to redefine styles Heading 1 through Heading 9. Everything seems to be going fine until I get to the last statement for the Heading 4 style:

    ActiveDocument.Styles(“Heading 4”).LinkToListTemplate ListTemplate:= _
    ListGalleries(wdOutlineNumberGallery).ListTemplates(5), ListLevelNumber:= _
    4

    I have a similar statement at the end Heading 1 through 3 and same for 5 through 9. The problem is that after that statement hits, my paragraph indent for Heading 1 is all out of wack. I’ve confirmed it does not happen sooner in the procedure (such as when the list level 1 is defined. List level information is defined for all list levels for each style.)

    In this case, I have the number located at a -36 indent (so it will not be seen beyond the visible left edge of the frame that contains it) and the text should start at 0. It changes so that the number is located at 0 and the text is at 72.

    Any ideas about this anomoly?

    Thanks!!
    Troy

    Viewing 0 reply threads
    Author
    Replies
    • #597566

      OK. I have more information and what may be a workaround. What I am doing is redefining every aspect of the Heading 1 through Heading 9 styles. I moved all the list template information to the end after defining all other aspects of the style. I then define the list gallery once (since they all use the same listtemplate).

      Here’s the bug/key:

      When I went to link all the styles to this listtemplate like this:

      ActiveDocument.Styles(“Heading 1”).LinkToListTemplate ListTemplate:= _
      ListGalleries(wdOutlineNumberGallery).ListTemplates(5), ListLevelNumber:= _
      1
      ActiveDocument.Styles(“Heading 2”).LinkToListTemplate ListTemplate:= _
      ListGalleries(wdOutlineNumberGallery).ListTemplates(5), ListLevelNumber:= _
      2
      etc.

      I found three things:

      1. Everything looked great after I linked Heading 1.

      2. EVERY Heading style was linked to this listtemplate when I linked Heading 1.

      3. Every attempt to link the next Headings (Heading 2, Heading 3, etc.) resulted in all the headings being indented an addition 36 pt.

      Conclusions (I’d love it if someone could confirm any of these!!):
      1. It appears that once you link one of the Heading styles to a list template, they are all automatically linked to that template. I can see how that could be a plus (what MS would call a “feature”). However, the fact that it does that without any documentation to that affect is a real pain.

      2. There is a bug if you try to link the Heading styles individually that indents 36 pt (or more likely whatever your default tab setting is).

      Any confirmation or corrections would be appreciated!!
      Troy

    Viewing 0 reply threads
    Reply To: LinkToListTemplate Error (VBA Word 2000)

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

    Your information: