Lawlords
asked on
Setting Header of the Word Document with vba code
Dear all,
I wish to design a macro for setting the header of the document with the code below but the result ended up with all 3 lines on the left. Can any help to resolve the problem?
Line 1 on the Right
Line 2 on the Left
Line 3 on the Left
Thanks very much
I wish to design a macro for setting the header of the document with the code below but the result ended up with all 3 lines on the left. Can any help to resolve the problem?
Line 1 on the Right
Line 2 on the Left
Line 3 on the Left
Thanks very much
With ActiveDocument.sections(1).Headers(wdHeaderFooterPrimary).Range
.Text = "Line 1 on the Right" & Chr(10)
.Paragraphs.Alignment = wdAlignParagraphRight
.InsertAfter "Line 2 on the Left" & Chr(10)
.Paragraphs.Alignment = wdAlignParagraphLeft
.InsertAfter "Line 2 on the Left"
.Paragraphs.Alignment = wdAlignParagraphLeft
End With
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Word can be very finicky with the methods used for populating text so you are not alone, (I struggle too).
Thank you for the prompt closure and grade.
Chris
Thank you for the prompt closure and grade.
Chris
ASKER