> Graham,
>
> Yes that works, thanks.
>
> The root question, I suppose, is if your can preset the TOC options
> "Use Outlining levels" and "Table entry fields" using VBA code:
>
> Sub InsertManualTOC()
> With Dialogs(wdDialogInsertTableOfContents)
> .UseOutlineLevel = 0
> .Fields = 1
> .Show
> End With
> End Sub
>
> Why can't you preset the "Styles" options. Sometimes I have a need
> to build TOCs from a combination of styles and TC fields and
> sometimes I need to build a TOC with just TC fields. The current
> behaviour of the TOC Options dialog is "Styles" and "Use outline
> level" are preset to "checked" and these value stick. Each time I
> want to create a TOC with a combination of styles and fields I have
> to change the options but they won't stick. I wanted to create a
> macro that opens the dialog with the Styles and fields preset to
> "checked" and anther macro that opens the dialog with just fields
> checked.
> Can't find a way :-(
>
>
>
>
> "Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> wrote in message
> news:uGtHDicXJHA.5764[ at ]TK2MSFTNGP04.phx.gbl...
>> How about
>>
>> With Selection.Fields
>> .Add Selection.Range, wdFieldTOC, "\f \h \z", False
>> .Update
>> End With
>> ActiveWindow.View.ShowFieldCodes = False
>>
>> ?
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com
>> Word MVP web site
http://word.mvps.org>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> Greg Maxey wrote:
>>> I have some requirements to build TOCs using strictly TC fields (no
>>> styles).
>>> I can do that easy enough by clicking on the InsertTOCdialog,
>>> clicking on Options, and changing the Build table of contents from
>>> options 1. Uncheck "Styles" 2. Uncheck "Outline levels" and 3.
>>> Check "table entry fields"
>>> I want to do this programmatically. I have figured out how to
>>> uncheck "Outline levels" and how to check "table field entries" but
>>> can find no way to uncheck "Styles"
>>>
>>> Sub InsertManualTOC()
>>> With Dialogs(wdDialogInsertTableOfContents)
>>> .UseOutlineLevel = 0
>>> .Fields = 1
>>> .Show
>>> End With
>>> End Sub
>>>
>>>
>>> Anyone have any ideas?
>>>
>>> Thanks.