Running a macro to format tables in a Word document - setting colors and Bolding labels work fine. I get a 'syntax' error when trying to FormatTables. Here is the part of the code that troubles me.
Sub FormatTables()
BoldLabels
' Format the tables
ActiveDocument.Select
Index = 1
Continue = True
Do While Continue = True
Selection.Find.ClearFormatting
With Selection.Find
.Text = "REQID"
.Replacement.Text = ""
.Forward = True
End With
Selection.Find.Execute
Do While Selection.Paragraphs(Index).Range.Characters.Count > 1
unitsMoved = Selection.MoveDown(Unit:=wdLine, Count:=1, Extend:=wdExtend)
If unitsMoved = 1 Then
Index = Index + 1
End If
Selection.Expand wdParagraph
'MsgBox "Index = " + Str$(Index), , "Warning"
Loop
Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.Expand wdLine
Index = 1
Continue = Selection.Find.Found
'DefListSep = getListSeparator()
'setListSeparator ("=")
If Continue = True Then
Selection.ConvertToTable Separator:=wdSeparateByDefaultListSeparator_,
NumColumns:=2, NumRows:=1, Format:=wdTableFormatGrid8, ApplyBorders:=True _
, ApplyShading:=True, ApplyFont:=True, ApplyColor:=True, ApplyHeadingRows _
:=True, ApplyLastRow:=False, ApplyFirstColumn:=True, ApplyLastColumn:= _
False, AutoFit:=True, AutoFitBehavior:=wdAutoFitFixed
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(2)
Selection.Collapse Direction:=wdCollapseEnd
End If
Loop
setListSeparator (DefListSep)
End Sub