PDA

View Full Version : Word vba code to select second page of TOC



anandyrh
08-30-2013, 05:21 AM
HI,

I am working on a big word transformation project...

I have written macro code to print Table of Contents, table of contents start from second page and end page is based on number of H1s in a word.

The first page is a cover page, here I am trying to convert the header of all the pages which has table of contents to look same as cover page.

I tried below vba code to add section break at the start of table of contents, but now how do I apply section break to all the other pages which has table of contents?



Selection.GoTo What:=wdGoToField, Which:=wdGoToNext, Count:=1, Name:="TOC"
Selection.InsertBreak Type:=wdSectionBreakNextPage


Regards,
Anand