[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Macro to AutoFit to Window all tables in a document

Posted on 2007-11-15
3
Medium Priority
?
6,838 Views
Last Modified: 2013-11-27
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.  
 
0
Comment
Question by:Phesant123
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 20294642
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
 
LVL 1

Author Comment

by:Phesant123
ID: 20304271
Cheers Graham i'll try this on Monday and confirm solution if macro is succesful.
0
 
LVL 1

Author Closing Comment

by:Phesant123
ID: 31409468
Great help,fast and to the point.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month19 days, 16 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question