views:

284

answers:

1

I need to create table - of-contents after mailmerge by macro as word does not support updating TOC field from TC fields.

Is it possible to automate creating TOC ?

+1  A: 

This will create a TOC using VBA:

    Set rangeWord = ActiveDocument.Range(Start:=0, End:=0)
    ActiveDocument.TablesOfContents.Add rangeWord, _
                                    UseFields:=True, _
                                    UseHeadingStyles:=True, _
                                    LowerHeadingLevel:=3, _
                                    UpperHeadingLevel:=1
DAC