View Single Post
 
Old 09-10-2012, 10:53 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

Hi knightmetal,

Your macro doesn't actually apply the autofit attrinbute. Rather, it sets a preferred width which will remain fixed regardless of changes to margins etc.

A true autofit macro is more like:
Code:
Sub Autofit()
Application.ScreenUpdating = False
Dim Tbl As Table
For Each Tbl In ActiveDocument.Tables
  Tbl.AutoFitBehavior (wdAutoFitWindow)
  Tbl.AllowAutoFit = True
Next
Application.ScreenUpdating = True
Application.ScreenRefresh
MsgBox "Done", vbOKOnly
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote