#1
|
|||
|
|||
Adjusting column widths of all tables in document
Is it possible to adjust the column widths in all tables in a document to some standard, (e.g. Column 1 = 6 cm, Column 2 = 10 cm) using VBA or a macro?
Can default column width be set in a table style? (I looked but cannot find a way) |
#2
|
|||
|
|||
Yes. However, there is a lot of things to consider when changing column widths. What do you want to happen to the overall table and the other associated columns. Here I set the table to the full width of the document (margin to margin) and adjust the other associated column widths proportionally as column 1 width is set to 36 points and column 2 to 72 points.
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim oTbl As Table For Each oTbl In ActiveDocument.Tables With oTbl .PreferredWidthType = wdPreferredWidthPercent .PreferredWidth = 100 .Columns(1).SetWidth 36, wdAdjustProportional .Columns(2).SetWidth 72, wdAdjustProportional End With Next oTbl lbl_Exit: Exit Sub End Sub |
#3
|
|||
|
|||
Thank you, that helps me a lot!
|
Tags |
default column width, table |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Combining 2 tables into 1 and use Table2's column widths (hoping for workaround dealing merged cells | CodingGuruInTraining | Word VBA | 24 | 10-07-2015 07:48 PM |
Trouble adjusting column widths on Word template | birdsall | Word | 2 | 03-04-2015 03:32 PM |
Pasting tables from Excel 2010 into Word 2010 - How to fix column widths? | GracieB | Word | 7 | 10-02-2013 06:24 AM |
Adjusting column widths | norwood | Word VBA | 0 | 09-24-2013 06:53 AM |
VBA code to fix column widths | molesy | Excel | 3 | 09-16-2013 12:51 PM |