'This example selects a rectangular area on the screen and copies the selection to the clipboard
Sub SelectTextAndCopy()
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.SearchText4("Profit", 1, 1, ThisScreen.DisplayRows, ThisScreen.DisplayColumns, FindOptions_Forward, TextComparisonOption_IgnoreCase)
EndCol = EndColPoint.column + Len("Profit")
'Get the last row in the table
Set EndRowPoint = ThisScreen.SearchText4("Dec", 1, 1, ThisScreen.DisplayRows, ThisScreen.DisplayColumns, FindOptions_Forward, TextComparisonOption_IgnoreCase)
EndRow = EndRowPoint.row
'Select a rectanglular area defined by the first row and column and the last row and column
rcode = ThisScreen.SelectText(1, 1, EndRow, EndCol, RegionOption_Rectangular)
'Copy the selection to the clipboard
rcode = ThisScreen.Copy2(CopySourceOption_Selection)
End Sub
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