Posted on 2004-08-30
I have a problem when i'm trying to automate Word.
I have a code like that:
'Incrementing the number of processed lines
iProcLines = iProcLines + 1
' Select a line.
oWordApp.Selection.MoveDown unit:=wdLine, Count:=1
'This is an alternative way to mark the line
If iProcLines = 216 Then Stop
If ((iProcLines > 0) And ((iProcLines Mod 24) = 0) And ((iTotalLines - (iBreaks - 1)) - (iBreaks - 1) * 24) > 24) Then
'Add a line break
iBreaks = iBreaks + 1
I have copy this code from a macro I have made in Word to move down through the lines of a document, however because of the Selection object, this code only works if the document is visible, if it's not the code runs but does the things in a completely differente way.
Is there a way to change Selection for another instruction?
Thanks in advance