Re: How do I modify a table of contents with a VBA macro? by macropod
macropod
Wed Jul 02 21:16:07 PDT 2008
Hi Carl,
Unless the "Use Case" is added to the existing heading, or you use another heading level for it (which means it'll have its own line
in the TOC), it's not possible to add the "Use Case" to the Word TOC field.
The only way around that, that I can see, would be to use a macro to create a TOC, unlink it (so that is becomes a plain text
representation of the TOC), then go through each of the TOC headings and retrieve the corresponding "Use Case" details to append to
the unlinked TOC entry. To update the TOC when new "Use Cases" are added/inserted, you'd probably need to delete the existing TOC
and create a new one from scratch.
--
Cheers
--
macropod
[MVP - Microsoft Word]
"CarlS" <CarlS@discussions.microsoft.com> wrote in message news:6E2B930A-21B3-42FB-8C66-87C991821A45@microsoft.com...
>I have a document that is not automated at all. It is a "Use Case" template
> that we are supposed to cut and paste then fill in for each use case. I have
> found that I can create a TOC at the beginning of the document and put in
> hyperlinks, remove page numbers, etc. (The TOC is based on the Heading1,
> Heading2 styles.)
>
> What I would like to do is loop through each use case (maybe go to each
> headng2 style?) and then drop down to the next cell, grab the use case
> reference number, and than add that to the TOC.
>
> Is this possible?
>
>