I need to insert two different text parts automatically into a newly generated file through an Excel Macro. This is an example of my code that I have.
First I clear allthe existing tabs to have a clean document, then I want to put "This text should be aligned on the left" aligned to the left and "This text should be aligned on the right" aligned to the right on the same line.
.Content.Paragraphs.TabStops.ClearAll
.Content.InsertAfter "This text should be aligned on the left"
.Content.Paragraphs.TabStops.Add Position:=NewPos, _
Alignment:=wdAlignTabRight, _
Leader:=wdTabLeaderLines
.Content.InsertAfter "This text should be aligned on the right"
.Content.InsertParagraphAfter
With this command I manage to generate a Tabstop in Word, but I don't seem able to position it, or to make "This text should be aligned on the right" align to the right.
In the end it should look like this:
The two text parts should be generated by VBA and aligned this way.