Macro to AutoFit to Window all tables in a document

Hi Macro experts.
Can you help me to AutoFit to Window all the tables in a single word document.

If I use the select all text option then try to use the AutoFit to Window, I can't as the option is not available for some reason.  

I hope a macro could acheive this. Please help with code.  
 
LVL 1
Phesant123Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
GrahamSkanConnect With a Mentor RetiredCommented:
No problem with a macro

Sub AutoFitToWind()
    Dim tbl As Table
    For Each tbl In ActiveDocument.Tables
        tbl.AutoFitBehavior wdAutoFitWindow
    Next tbl
End Sub


1
 
Phesant123Author Commented:
Cheers Graham i'll try this on Monday and confirm solution if macro is succesful.
0
 
Phesant123Author Commented:
Great help,fast and to the point.
0
All Courses

From novice to tech pro — start learning today.