Microsoft Word Table so it is centered based on width of page
Screenshot of 1) table out of alignment 2) table aligned(using the table properties box) 3) Code I need help with to automate calculating what the value should be based on the width of the table
'Error 2. the comma at the end of the following line causes an error, I remove. the comma and it runs
'however the PageWidth and LeftMargin return 9999999
LeftIndent = (ActiveDocument.PageSetup.PageWidth - ActiveDocument.PageSetup.LeftMargin - TotalWidth),
tb.Rows.SetLeftIndent LeftIndent:=LeftIndent, RulerStyle:=wdAdjustNone
end if
next
Error 1:
Run-time error '5992':
Cannot access individual columns in this collection because the table has mixed cell widths
Open in new window