Word ignores "UseHeadingStyles" on TablesOfContents.Add?

A

Andreas Baus

Am I doing something wrong, or does Word really ignore whether I set
the "UseHeadingStyles" parameter to "false" in a call to
TablesOfContents.Add?
Because that's what I do trying to insert a ToC that does only include
styles specified by me, and not the default "Heading <n>" styles.
I thought the UseHeadingStyles flag was just what I needed for that;
but no matter what I set it to, the resulting ToC contains standard
headings too (the created TOC field code contains the \o switch).

This can't be right, can it?

Strangely enough, if I insert a ToC without heading styles manually, I
get exactly what I want; if I record that process as a macro (which in
it's code contains a call to TablesOfContents.Add quite exactly like
what I wrote), and run that macro, I get a ToC *with* heading styles.
Something seems to be broken here (If this is a bug, it's been there
at least since Word97, and still hasn't been fixed, because it's still
there in Word2000 and WordXP; I tried it on these three versions with
the same result)...
 
C

Cindy M -WordMVP-

Hi Andreas,

Why not insert the TOC field with the exact settings you want to use,
then update it?

Field.Add Range:=rng, Type:=wdFieldEmpty, Text:="TOC etc."
Am I doing something wrong, or does Word really ignore whether I set
the "UseHeadingStyles" parameter to "false" in a call to
TablesOfContents.Add?
Because that's what I do trying to insert a ToC that does only include
styles specified by me, and not the default "Heading <n>" styles.
I thought the UseHeadingStyles flag was just what I needed for that;
but no matter what I set it to, the resulting ToC contains standard
headings too (the created TOC field code contains the \o switch).

This can't be right, can it?

Strangely enough, if I insert a ToC without heading styles manually, I
get exactly what I want; if I record that process as a macro (which in
it's code contains a call to TablesOfContents.Add quite exactly like
what I wrote), and run that macro, I get a ToC *with* heading styles.
Something seems to be broken here (If this is a bug, it's been there
at least since Word97, and still hasn't been fixed, because it's still
there in Word2000 and WordXP; I tried it on these three versions with
the same result)...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top