L
Lilivati
I am playing around with VBA in Word to become familiar with it before
beginning a project. So far it has been going well, but I am currently
stumped on this InsertAfter issue. Basically to my mind it should
insert text after the selection, but on the same line. What it is
doing is inserting the text on a new line, which Word then considers to
be a new paragraph. Here is my little practice code:
Sub Test()
Options.ReplaceSelection = False
Dim i As Integer
For i = 1 To 3
Paragraphs(i).Range.Select
Selection.Copy
Application.Selection.InsertAfter " -i value: " & i & "- "
Selection.Paste
Next i
' (this is in here because leaving it false does some annoying things
to how backspace works)
Options.ReplaceSelection = True
End Sub
I am sure there is something simple here I am missing, but for the life
of me I can't figure out what.
beginning a project. So far it has been going well, but I am currently
stumped on this InsertAfter issue. Basically to my mind it should
insert text after the selection, but on the same line. What it is
doing is inserting the text on a new line, which Word then considers to
be a new paragraph. Here is my little practice code:
Sub Test()
Options.ReplaceSelection = False
Dim i As Integer
For i = 1 To 3
Paragraphs(i).Range.Select
Selection.Copy
Application.Selection.InsertAfter " -i value: " & i & "- "
Selection.Paste
Next i
' (this is in here because leaving it false does some annoying things
to how backspace works)
Options.ReplaceSelection = True
End Sub
I am sure there is something simple here I am missing, but for the life
of me I can't figure out what.