Mega Code Archive

 
Categories / VisualBasic Script / Word
 

Adding a Column to a Table

'The following statements use the Count property to check the number of columns in the first table in the active document and Sub add()     With ActiveDocument.Tables(1)         .Select         If .Columns.Count < 5 Then             Do Until .Columns.Count = 5                 .Columns.add BeforeColumn:=.Columns(.Columns.Count)             Loop         End If     End With End Sub