SearchText3 Method (Screen)
Searches for the specified text on the screen, from the specified starting location to the specified ending location.
expression.SearchText3( _
ByVal As String, _
ByVal As Integer, _
ByVal startColumn As Integer, _
ByVal As Integer, _
ByVal endColumn As Integer, _
ByVal As FindOptions _
) As ScreenPoint object
where
expression is a variable that represents a
Screen Object
Parameters
- text
- The text string to search for.
- startRow
- Starting row for the search. The valid range is 1 through the number of rows.
- startColumn
- Starting column for the search. The valid range is 1 through the number of columns.
- endRow
- Ending row for the search.
- endColumn
- Ending column for the search.
- findOption
- A FindOptions value that specifies the search direction.
Return Value
A
ScreenPoint object that contains the coordinate of the located text or null, if the text is not found.
This example sets a selection point, extends it, and copies the selected area to the clipboard.
Sub SetAndExtendSelection()
Dim rcode As ReturnCode
Dim StartSel As ScreenPoint
Dim EndColPoint As ScreenPoint
Dim EndCol As Integer
Dim EndRowPoint As ScreenPoint
Dim EndRow As Integer
Dim EndSel As ScreenPoint
'Get the last column in the table
Set EndColPoint = ThisScreen.SearchText3("Profit", 1, 1, ThisScreen.DisplayRows, ThisScreen.DisplayColumns, FindOptions_Forward)
EndCol = EndColPoint.column + Len("Point")
'Get the last row in the table
Set EndRowPoint = ThisScreen.SearchText3("Dec", 1, 1, ThisScreen.DisplayRows, ThisScreen.DisplayColumns, FindOptions_Forward)
EndRow = EndRowPoint.row
'Get the location for the start of the selection
Set StartSel = ThisScreen.SearchText3("Jan", 1, 1, ThisScreen.DisplayRows, ThisScreen.DisplayColumns, FindOptions_Forward)
'Set the start of the selection
ThisScreen.SetSelectionStartPos StartSel.row, StartSel.column
'Extend the selection to the last row and column in the table
ThisScreen.ExtendSelectionRect EndRow, EndCol
'Copy the selected area to the clipboard
rcode = ThisScreen.Copy2(CopySourceOption_Selection)
End Sub