PDA

View Full Version : How to control winword & table by Excel VBA ?



justuptou
08-06-2018, 08:57 PM
I use Excel VBA to output a report as winword format, how can I put the font at table cells alignment in centre by Excel VBA code ?

macropod
08-06-2018, 11:22 PM
Paragraph alignments in Word are managed via the .ParagraphFormat.Alignment property. For example:

wdDoc.Tables(1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
or, for late binding:

wdDoc.Tables(1).Range.ParagraphFormat.Alignment = 1

macropod
08-06-2018, 11:27 PM
It seems you've asked about this sort of thing before: http://www.vbaexpress.com/forum/showthread.php?58708-Excel-VBA-How-to-set-the-cell-alignment-at-word-table