Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-08-2012, 09:25 AM
Ulodesk Ulodesk is offline Resize and center tables Windows 7 64bit Resize and center tables Office 2010 64bit
Word 2013 Expert Cert
Resize and center tables
 
Join Date: Sep 2009
Location: Virginia
Posts: 866
Ulodesk is on a distinguished road
Default Resize and center tables

I have a macro that resizes all tables in a document to margin width, but it doesn't center them, which is also part of our style. I have tried to find the right code in VBA, starting a line with oTbl. and seeing what optins come up, but it's pure trial and error -- and all errors. There doesn't seem to be a horizontal alignment tag... Here's what I have:




Code:
 
Sub ResizeAllTables()
    Dim oTbl As Table
    For Each oTbl In ActiveDocument.Tables
        oTbl.AutoFitBehavior wdAutoFitFixed
        With ActiveDocument.PageSetup
            oTbl.PreferredWidth = .PageWidth - .LeftMargin - .RightMargin
        End With
    Next oTbl
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Resize and center tables Word VBA: Resize Table Width??? tinfanide Word VBA 5 04-21-2012 03:00 PM
Resize and center tables How to resize the number of the heading after being disappeared??? Jamal NUMAN Word 1 04-15-2011 06:21 PM
Resize and center tables Resize video across multiple slides joelas PowerPoint 3 09-28-2010 07:59 PM
Resize-to-fit Table Columns (PowerPoint) icu222much PowerPoint 0 06-06-2010 11:21 AM
equation automatic resize Landsman Word 0 02-24-2009 09:55 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft