Thread: [Solved] Table Formatting
View Single Post
 
Old 04-10-2012, 09:01 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I don't know what you mean by (1).
For (2), you should define a Style with the required attributes.
For (3), you could use the following macro, provided you change "MyStyle" to whatever Style name you create in (2):
Code:
Sub TableOptimize()
Dim myTable As Table
If Selection.Information(wdWithInTable) = False Then Exit Sub
Set myTable = Selection.Tables(1)
With myTable
  .Range.Style = "MyStyle"
  .AutoFitBehavior (wdAutoFitContent)
  .AutoFormat Format:=wdTableFormatContemporary '35
  .AutoFitBehavior (wdAutoFitWindow)
  .AutoFitBehavior (wdAutoFitFixed)
End With
End Sub
Also, I doubt that all the AutoFitBehavior statements are required. I've left them in only because I don't know whether they might all be needed for your table.

PS: Please use code tags (see the advanced tab) when posting code.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote