![]() |
|
#8
|
||||
|
||||
|
Quote:
Code:
Sub Test3() Application.ScreenUpdating = False Dim Tbl As Table Const text_a As String = "A text" Const text_b As String = "A longer text to make the column need more width" Const text_c As String = "More text" Set Tbl = ActiveDocument.Tables.Add(Range:=Selection.Range, NumRows:=4, NumColumns:=3) With Tbl .AllowAutoFit = False .Rows(1).HeadingFormat = True .PreferredWidthType = wdPreferredWidthPoints .PreferredWidth = CentimetersToPoints(17.5) .Columns(1).PreferredWidth = CentimetersToPoints(3.2) .Columns(2).PreferredWidth = CentimetersToPoints(13.4) .ApplyStyleHeadingRows = True .ApplyStyleLastRow = True .ApplyStyleFirstColumn = True .ApplyStyleLastColumn = True .LeftPadding = 0 .RightPadding = 0 .Borders.Enable = True .Cell(1, 1).Range.Text = text_a .Cell(1, 2).Range.Text = text_b .Cell(1, 3).Range.Text = text_c End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| create fields with multiple lines - fix column width in table | expert4knowledge | Word | 4 | 02-14-2014 01:06 PM |
Inserted AutoText table incorrectly formatted - unless macro paused!
|
Smallweed | Word VBA | 4 | 01-16-2014 03:15 PM |
Column Width keeps changing
|
alsmith | Word Tables | 1 | 05-25-2013 02:09 AM |
Word 2012: Change column width changes table width
|
OpfinnarJocke | Word Tables | 1 | 09-22-2012 04:03 AM |
Column width
|
markg67 | Word | 2 | 06-07-2010 07:40 PM |