it-partners Home   |  Site Map
 Support
       Bits and Pieces

Copy selected text to the clipboard

This code can be used to copy text selected in itGrid to the clipboard.

In particular, this example can be used to transfer text to Microsoft Excel.

Private Sub itGrid1_KeyDown(ByRef KeyCode As Integer, ByRef Shift As Integer )

  With itGrid1
    If (.FocusCol <> -1) And (KeyCode = vbKeyC) And (Shift = vbCtrlMask) Then

      Clipboard.SetText .TextMatrix(.Row, .Col, .RowSel, .ColSel, vbCrLf, vbTab)

    End If
  End With

End Sub