Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Table of Contents Entries

$
0
0

Hi

I created a custom Table of Contents in Word (Office 365) where i only wanted to use my custom styles called Style 1, Style 2 and Style 3 (i.e. wanted to exclude inbuilt styles Heading 1, Heading 2 and Heading 3). The Table of Contents was created exactly as required during which i recorded the macro (see below).

Unfortunately when i run the recorded macro, the inbuilt styles Heading 1, Heading 2 and Heading 3 are also included in my Table of Contents along with my custom styles Style 1, Style 2 and Style 3.

Can anyone assist in letting me know why the Table of Contents which was originally created correctly, then uses additional styles when the macro is replayed?

Very much appreciate any advice offered.

With ActiveDocument
        .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _
            True, UseHeadingStyles:=False, IncludePageNumbers:=True, AddedStyles _
            :="Style 1,1,Style 2,2,Style 3", _
            UseHyperlinks:=False, HidePageNumbersInWeb:=True, UseOutlineLevels:= _
            False
        .TablesOfContents(1).TabLeader = wdTabLeaderSpaces
        .TablesOfContents.Format = wdIndexIndent
End With


Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>