
Error creating rows with columns having different column width
I get a Run time error 5991 "cannot access individual columns in this
collection because the table has mixed cell widths" when I try to run
the macro to create rows with columns having different column width.
here is the code. Can anyone please help me?
Sub CreateTable()
'
' CreateTable Macro
' Macro recorded 07.01.2003 by System Integration
'
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=1,
NumColumns:= _ 3, DefaultTableBehavior:=wdWord9TableBehavior,
AutoFitBehavior:= _
wdAutoFitFixed
Selection.Tables(1).AllowAutoFit = False ' i tried this after i
searched for this error in net, but no use
Selection.Tables(1).Columns(1).PreferredWidthType =
wdPreferredWidthPoints ' this one works neither!
Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=26.7,
RulerStyle:= _
wdAdjustNone
Selection.Tables(1).Columns(3).SetWidth ColumnWidth:=149.25,
RulerStyle:= _
wdAdjustNone
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.MoveRight Unit:=wdCharacter, Count:=2, Extend:=wdExtend
Selection.Font.Size = 9
Selection.MoveDown Unit:=wdLine, Count:=1
End Sub