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.
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 " "
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.