update TC fields 
Author Message
 update TC fields

I am having trouble figuring out how to use VBA to update
a TC field on my table of contents page.  

This is the code I have used to mark a spot to add an
index entry:  
With ActiveDocument
        .TablesOfContents.Add Range:=Selection.Range,
RightAlignPageNumbers:= _
            True, UseHeadingStyles:=False,
UseFields:=True, TableID:="C", _
            IncludePageNumbers:=True, AddedStyles:="",
UseHyperlinks:=True, _
            HidePageNumbersInWeb:=True
        .TablesOfContents(1).TabLeader = wdTabLeaderDots
        .TablesOfContents.Format = wdIndexIndent
End With

Everything works fine the first time I create my table of
contents.  I just can't seem to get it to update if the
user wants to add another item.  It works fine using F9
when I place the cursor to the left of the entry on my
table of contents page.  But I can't recreate this using
VBA as I can't figure out how to address this item in the
table of contents.  Where it generates is this code:

{TOC\f\h\z}.  The entire TOC is bolded, which is unlike
the other tables of contents that I have created.

Can anyone help?  If so, I would be most appreciative.



Fri, 11 Mar 2005 09:08:55 GMT  
 update TC fields
Hi Joanne

is this the solution?
ActiveDocument.TablesOfContents(1).Update

hth, Martin

--
Martin S?gesser, SIBS
www.sibs.ch



Quote:
> I am having trouble figuring out how to use VBA to update
> a TC field on my table of contents page.  

> This is the code I have used to mark a spot to add an
> index entry:  
> With ActiveDocument
>         .TablesOfContents.Add Range:=Selection.Range,
> RightAlignPageNumbers:= _
>             True, UseHeadingStyles:=False,
> UseFields:=True, TableID:="C", _
>             IncludePageNumbers:=True, AddedStyles:="",
> UseHyperlinks:=True, _
>             HidePageNumbersInWeb:=True
>         .TablesOfContents(1).TabLeader = wdTabLeaderDots
>         .TablesOfContents.Format = wdIndexIndent
> End With

> Everything works fine the first time I create my table of
> contents.  I just can't seem to get it to update if the
> user wants to add another item.  It works fine using F9
> when I place the cursor to the left of the entry on my
> table of contents page.  But I can't recreate this using
> VBA as I can't figure out how to address this item in the
> table of contents.  Where it generates is this code:

> {TOC\f\h\z}.  The entire TOC is bolded, which is unlike
> the other tables of contents that I have created.

> Can anyone help?  If so, I would be most appreciative.



Fri, 11 Mar 2005 17:51:35 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Format of TC fields affecting TOC styles

2. Using--After Update-- to update field in table.

3. Updating fields: footer doesn't update right

4. 2nd SQL Server update after update text field corrupts row - using RDO

5. Updating data to a memo field using SQL UPDATE

6. How to update datetime field with NULL using ADO update

7. Using Update to update an Access field

8. Use report fields to update table fields

9. single field to multiple field update qry

10. Update a Bound field with data from unbound field

11. update a field in a record depand on other field

12. Want to auto update date field based on adding check in another field

 

 
Powered by phpBB® Forum Software