Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Screen Object / Copy3 Method
A CopySourceOption value that specifies what should be copied to the Clipboard.
A CopyFormatOption that specifies the format in which data is copied.
Example
In This Topic
    Copy3 Method
    In This Topic
    Copies data to the Clipboard given the CopyFormatOption.
    Syntax
    expression.Copy3( _
       ByVal source As CopySourceOption, _
       ByVal format As CopyFormatOption _
    ) As ReturnCode
    where expression is a variable that represents a Screen Object

    Parameters

    source
    A CopySourceOption value that specifies what should be copied to the Clipboard.
    format
    A CopyFormatOption that specifies the format in which data is copied.

    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 in XML format
    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 in XML format.
        rcode = ThisScreen.Copy3(CopySourceOption_Selection, CopyFormatOption_AsXML)
        
        'Remove the screen selection so th enext copy command doesn't use it
        rcode = ThisScreen.ClearSelection
        
    End Sub
    See Also