R
rharrison
I am creating a report from data held in excel using VBA. So far I am able to
generate the information onto the report, but I am struggling to format the
text, namely the alignment of text. Although I seem to have programmed it
correctly, it still aligns everything to the left.
This is a basic idea I had, but it doesn't work. Does anyone have an idea of
how to fix this?
Also, how do you program the 'Tab' function?
Set testdoc = CreateObject("Word.Application")
testdoc.Visible = True
testdoc.documents.Add
testdoc.Selection.TypeText "test"
testdoc.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
testdoc.Selection.TypeParagraph
testdoc.Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
testdoc.Selection.TypeText "test2"
generate the information onto the report, but I am struggling to format the
text, namely the alignment of text. Although I seem to have programmed it
correctly, it still aligns everything to the left.
This is a basic idea I had, but it doesn't work. Does anyone have an idea of
how to fix this?
Also, how do you program the 'Tab' function?
Set testdoc = CreateObject("Word.Application")
testdoc.Visible = True
testdoc.documents.Add
testdoc.Selection.TypeText "test"
testdoc.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
testdoc.Selection.TypeParagraph
testdoc.Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
testdoc.Selection.TypeText "test2"