InfoConnect VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Screen Object / ClearSelection Method
Example
In This Topic
ClearSelection Method
In This Topic
Clears current selection. Does not apply to VT terminal emuations.
Syntax
expression.ClearSelection() As ReturnCode
where expression is a variable that represents a Screen Object

Return Value

One of the following ReturnCode enumeration values.

Member Description
Cancelled Cancelled.
Error Error.
PermissionRequired Permission is required.
Success Success.
Timeout Timeout condition.
Truncated The text is truncated.

Example
This example selects an area on the screen and copies it to the Windows Clipboard
Sub SelectAreaToCopy()
    Dim rcode As ReturnCode
    
    Dim StartSel As ScreenPoint 'Screen location to start the selection
        
    Dim EndColPoint As ScreenPoint 'Screen location with the last column for the selection
    Dim EndCol As Integer
    
    Dim EndRowPoint As ScreenPoint 'Screen location with the last row for the selection
    Dim EndRow As Integer
    
    'Get starting point for the selection
    Set StartSel = ThisScreen.SearchText4("Jan", 1, 1, ThisScreen.DisplayRows, ThisScreen.DisplayColumns, FindOptions_Forward, TextComparisonOption_IgnoreCase)
    
   'Get the last column in the selection
    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 selection
    Set EndRowPoint = ThisScreen.SearchText4("Dec", 1, 1, ThisScreen.DisplayRows, ThisScreen.DisplayColumns, FindOptions_Forward, TextComparisonOption_IgnoreCase)
    EndRow = EndRowPoint.Row
   
    'Start the selection
    ThisScreen.SetSelectionStartPos StartSel.Row, StartSel.Column
    
    'Extend the selection to the last row and column
    ThisScreen.ExtendSelectionRect EndRow, EndCol
    
    'Copy the selection to the clipboard.
    rcode = ThisScreen.Copy2(CopySourceOption_Selection)
    
    'Remove the screen selection so th enext copy command doesn't use it
    rcode = ThisScreen.ClearSelection
    
End Sub
See Also