#1   Report Post  
Posted to microsoft.public.word.docmanagement
Roderick O'Regan Roderick O'Regan is offline
external usenet poster
 
Posts: 19
Default TOC in Word 2007

Word 2007 in Vista Business.

I've got a template (.dotm) with two TOCs. The first one is three
levels deep (Headings 1 to 3) and the second one showing two levels
deep and used for Appendices (Using Headings 7 & 8). These TOCs are
created programmatically.

I've created a button on a custom tab to update fields and TOCs.

The line of code to update the TOCs says:
with ActiveDocument
..TablesOfContents(1).Update
..TablesOfContents(2).Update
End With

When I run the procedure to update the TOCs I get an error which says
something to the effect:
"Method Update of Object TableOfContents failed".

Nothing gets updated!

Now here is the strange bit: using this coding in a Word 2003 template
works perfectly. Bring it over to W2007 and it doesn't work.

Is there something new about TOCs in W2007 and VBA coding that I've
missed? Could someone advise, please?

Roderick
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default TOC in Word 2007

Does your macro take into account the fact that pressing F9 in a TOC will
ordinary pop up a dialog requiring a choice between the entire table and
just the page numbers? That would be true in any version, however.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

"Roderick O'Regan" wrote in message
...
Word 2007 in Vista Business.

I've got a template (.dotm) with two TOCs. The first one is three
levels deep (Headings 1 to 3) and the second one showing two levels
deep and used for Appendices (Using Headings 7 & 8). These TOCs are
created programmatically.

I've created a button on a custom tab to update fields and TOCs.

The line of code to update the TOCs says:
with ActiveDocument
.TablesOfContents(1).Update
.TablesOfContents(2).Update
End With

When I run the procedure to update the TOCs I get an error which says
something to the effect:
"Method Update of Object TableOfContents failed".

Nothing gets updated!

Now here is the strange bit: using this coding in a Word 2003 template
works perfectly. Bring it over to W2007 and it doesn't work.

Is there something new about TOCs in W2007 and VBA coding that I've
missed? Could someone advise, please?

Roderick



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Roderick O'Regan Roderick O'Regan is offline
external usenet poster
 
Posts: 19
Default TOC in Word 2007

Thanks for the reply Suzanne.

Actually, pressing F9 within a TOC in my .dotm template does nothing
at all.

The thing that is really disturbing is that the exact coding and
structure in W2003 works perfectly. Put it into W2007 and errors
mentioned previously appear.

The only way I can get all my TOCs and TOFs to update is to go to (in
W2007) ReferencesUpdate Table.

Using the macro recorder to see what it is actually doing, it uses, of
all things the coding 'Wordbasic.UpdateTableOfContents' of all things!

Roderick

On Thu, 28 Aug 2008 12:36:22 -0500, "Suzanne S. Barnhill"
wrote:

Does your macro take into account the fact that pressing F9 in a TOC will
ordinary pop up a dialog requiring a choice between the entire table and
just the page numbers? That would be true in any version, however.

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default TOC in Word 2007

Oh, ouch! Another example of how impossible it is to completely eradicate
Word Basic from VBA!

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

"Roderick O'Regan" wrote in message
...
Thanks for the reply Suzanne.

Actually, pressing F9 within a TOC in my .dotm template does nothing
at all.

The thing that is really disturbing is that the exact coding and
structure in W2003 works perfectly. Put it into W2007 and errors
mentioned previously appear.

The only way I can get all my TOCs and TOFs to update is to go to (in
W2007) ReferencesUpdate Table.

Using the macro recorder to see what it is actually doing, it uses, of
all things the coding 'Wordbasic.UpdateTableOfContents' of all things!

Roderick

On Thu, 28 Aug 2008 12:36:22 -0500, "Suzanne S. Barnhill"
wrote:

Does your macro take into account the fact that pressing F9 in a TOC will
ordinary pop up a dialog requiring a choice between the entire table and
just the page numbers? That would be true in any version, however.




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Powerpoint 2007 slide as landscape into Word 2007 portrait aDude Page Layout 1 June 16th 08 12:12 AM
insert Access 2007 database table into a Word 2007 doc and print Leedell Microsoft Word Help 0 October 20th 07 08:10 AM
Unable to download templates using Word 2007 (MS Office 2007 Stand The Big K Microsoft Word Help 2 April 19th 07 03:10 AM
multi-page visio 2007 in word 2007 with automatic figure caption russ Microsoft Word Help 0 March 20th 07 09:44 PM
Change layout of address inserted from Outlook 2007 to Word 2007? Ron Perry Microsoft Word Help 3 December 26th 06 08:21 PM


All times are GMT +1. The time now is 08:02 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"