View Single Post
  #6  
Old July 5th, 2006, 06:51 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default how do i select and format all tables in a document at once

I sometimes first use AutoFit to Content, then to Window, and finally to
Fixed (so Word doesn't continually spend ressources in the background).
For that to work, I had to stick in an "ActiveDocument.Repaginate" after
each changing of the AutoFitBehaviour.


I just checked my macro code, and it has in fact two .Repaginate's each
time:

Sub TablesOptimize()
Dim myTable As Table
For Each myTable In ActiveDocument.Tables
myTable.AutoFitBehavior (wdAutoFitContent)
Next myTable
ActiveDocument.Repaginate
ActiveDocument.Repaginate
For Each myTable In ActiveDocument.Tables
myTable.AutoFitBehavior (wdAutoFitWindow)
Next myTable
ActiveDocument.Repaginate
ActiveDocument.Repaginate
For Each myTable In ActiveDocument.Tables
myTable.AutoFitBehavior (wdAutoFitFixed)
Next myTable
ActiveDocument.Repaginate
ActiveDocument.Repaginate
End Sub

It seemed to work well... seems I had to tell Word twice, to emphasize that
I really meant it g.
Or maybe somebody has a better idea to force the tables to adjust to the new
setting/behaviour?

Greetings,
Klaus