Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Place text at a specific column in Word

Status
Not open for further replies.

tmcnutt

Programmer
May 17, 2002
83
US
I have a VB app that uses Word to generate a report and I want to know if I can insert text at a certain column location on a line. I don't want to create a table if I don't have to. Thanks in advance.

Tom
 
If you are using a fixed spacing font, I guess this might work:

Sub PlaceAtCol(s As String, col As Integer)
Selection.EndKey wdLine
Do While Selection.Information(wdFirstCharacterColumnNumber) < col
Selection.TypeText &quot; &quot;
Loop
Do While Selection.Information(wdFirstCharacterColumnNumber) > col
Selection.MoveLeft wdCharacter
Loop
Application.Options.Overtype = True
Selection.TypeText s
Application.Options.Overtype = False
End Sub
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top