Skip to main content
Known Participant
April 26, 2008
Question

How can i create TOC without creating TOC styles?

  • April 26, 2008
  • 5 replies
  • 847 views
Set MyTOCStyle = myDoc.TOCStyles.Add 'without this line next one doesn't work
myDoc.CreateTOC MyTOCStyle, True

What should i write instead of "MyTOCStyle" in 2-nd line
cause i have my TOC styles already in document?

Thanks
This topic has been closed for replies.

5 replies

Known Participant
April 30, 2008
b MyInd.ActiveWindow.ActivePage = myDoc.Pages.Item(1)

Yes! sure, i had first to active page. Thanks.
Inspiring
April 29, 2008
You might notice that though you created the variable named "myPage" you did nothing with it.

Try adding (converted to VB):

app.activeWindow.activePage = myPage;

before making the TOC.

Dave
Known Participant
April 29, 2008
Now i can't make myDoc place TOC on the needed page (# 1). It creates and place on pasteboard.
How to open (to see on screen) needed page?

Tried this:

Set myPage = myDoc.Pages.Item(1)

myDoc.CreateTOC MyTOCStyle, True, , Array(-170, 93).

TOC appears on the current page covering main text.
Known Participant
April 28, 2008
I've got so construction:

Set MyTOCStyle = myDoc.TOCStyles.Add
Set myTOCStyleEntry = MyTOCStyle.TOCStyleEntries.Add("Head1")
'point which heading we'd like to see on TOC
myTOCStyleEntry.FormatStyle = "TOC Zag1"
myTOCStyleEntry.Separator = vbTab

Set myTOCStyleEntry = MyTOCStyle.TOCStyleEntries.Add("Head2")
'point another heading we'd like to see on TOC
myTOCStyleEntry.FormatStyle = "TOC Zag2"
myTOCStyleEntry.Separator = vbTab
myDoc.CreateTOC MyTOCStyle, True, , Array(-170, 93)
Inspiring
April 26, 2008
TOC styles have names, so if you know the name of the one you want, you should change the first line to call it up by name. In JavaScript, this would be:

MyTOCStyle = myDoc.tocStyles.itemByName("TOCstyleName");

Dave