COM select text / find text

Get help with using AutoHotkey and its commands and hotkeys
Johana
Posts: 184
Joined: 02 May 2017, 02:34

COM select text / find text

22 May 2018, 02:15

Hello!

I am trying to select text inside a Word-document using COM. The problem that I encountered is that I don't know how many lines to select, so something like

Code: [Select all] [Download] GeSHi © Codebox Plus

oWord.Selection.MoveDown(5, 3, 9)
will not help me. I am trying to select from row 7 to the END char of page 1. (not the end of page 1 because there's a unwanted empty row).

Question two: I am trying to find a word in Word (with COM) and putting it into a variable.

Using

Code: [Select all] [Download] GeSHi © Codebox Plus

oWord.Selection.Find.Execute("My word")
works for the entire document except for the part I want to search. It's inside a textbox.

Help appreicated.
Johana
Posts: 184
Joined: 02 May 2017, 02:34

Re: COM select text / find text

22 May 2018, 04:02

Solved the first part like this:

Code: [Select all] [Download] GeSHi © Codebox Plus

oWord.Selection.Goto(1, 2) ; Go to begging of page 2
oWord.Selection.MoveUp(5, 2, 0) ; Move up without selecting, 2 rows
oWord.Selection.HomeKey(6, 1) ; Mark everything from where carat is to begging.
oWord.Selection.MoveDown(5, 4, 1) ; Move down 4


Return to “Ask For Help”

Who is online

Users browsing this forum: tmplinshi and 51 guests