View Single Post
 
Old 03-28-2016, 05:15 AM
rpb925 rpb925 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Mar 2016
Location: Sydney
Posts: 17
rpb925 is on a distinguished road
Default

Hi Paul for formatting the width of columns of the New Tables I'm rocking the below code but it seems a bit hit and miss. Sometimes it says it has some server error but other times it's OK. I'm not sure if it's wdPreferredWidthPoints that it doesn't like but it's somewhere around that region. Cheers.

Code:
Set wdTbl = .Tables.Add(Range:=.Range.Characters.Last, NumRows:=17, NumColumns:=2, _
        DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed)
      With wdTbl
        .Style = "Table Grid"
        .ApplyStyleHeadingRows = True
        .ApplyStyleLastRow = False
        .ApplyStyleFirstColumn = True
        .ApplyStyleLastColumn = False
        .ApplyStyleRowBands = True
        .ApplyStyleColumnBands = False
        .Borders(wdBorderLeft).LineStyle = wdLineStyleNone
        .Borders(wdBorderRight).LineStyle = wdLineStyleNone
        .Borders(wdBorderTop).LineStyle = wdLineStyleNone
        .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
        .Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
        .Borders(wdBorderVertical).LineStyle = wdLineStyleNone
        .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
        .Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
        .Borders.Shadow = False
       
       With .Columns(1)
       .PreferredWidthType = wdPreferredWidthPoints
     .PreferredWidth = CentimetersToPoints(3)
    End With
             
     With .Columns(2)
       .PreferredWidthType = wdPreferredWidthPoints
     .PreferredWidth = CentimetersToPoints(13)
    End With
Reply With Quote