J
Jak
MS Office 2003
Hi All
I am putting together a macro and I am really stuck on how to get the cursor
to move to the end of a line in Word. I have set the cursor to go to the
begining of line 1 and enter some text ie.
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst, Count:=1, Name:=""
Selection.Find.ClearFormatting
Selection.TypeText Text:="myArray = Array("
I now need to go to the end of line 1 and then insert some text and then
move down a line and continue to insert the text ie
Selection.TypeText Text:=", _"
Selection.MoveDown Unit:=wdLine, Count:=1
The MoveRight ie
Selection.MoveRight Unit:=wdWord, Count:=30, Extend:=wdExtend
I have tried but length of the line may vary and the code would fail. Any
help with a loop that finds the end of line 1, enters text and then moves 1
line down and inserts the text until the last line is reached is what I am
hopeing to achieve.
Any assistance with this would be greatly appreciated.
Jak
Hi All
I am putting together a macro and I am really stuck on how to get the cursor
to move to the end of a line in Word. I have set the cursor to go to the
begining of line 1 and enter some text ie.
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst, Count:=1, Name:=""
Selection.Find.ClearFormatting
Selection.TypeText Text:="myArray = Array("
I now need to go to the end of line 1 and then insert some text and then
move down a line and continue to insert the text ie
Selection.TypeText Text:=", _"
Selection.MoveDown Unit:=wdLine, Count:=1
The MoveRight ie
Selection.MoveRight Unit:=wdWord, Count:=30, Extend:=wdExtend
I have tried but length of the line may vary and the code would fail. Any
help with a loop that finds the end of line 1, enters text and then moves 1
line down and inserts the text until the last line is reached is what I am
hopeing to achieve.
Any assistance with this would be greatly appreciated.
Jak