| These are some Edit functions (Cut, Copy, Paste, Delete, Select All), similar to some Texteditors, for the MSFlexGrid Control. You need a Form with a FlexGrid (MSFlexGrid1). Private Sub EditCut() 'Cut the selection and put it on the Clipboard EditCopy EditDelete End Sub Private Sub EditCopy() 'Copy the selection and put it on the Clipboard Clipboard.Clear Clipboard.SetText MSFlexGrid1.Clip End Sub Private Sub EditPaste() 'Insert Clipboard contents If Len(Clipboard.GetText) Then MSFlexGrid1.Clip = _ Clipboard.GetText End Sub Private Sub EditDelete() 'Deletes the selection Dim i As Integer Dim j As Integer Dim strClip As String With MSFlexGrid1 For i = 1 To .RowSel For j = 1 To .ColSel strClip = strClip & "" & vbTab Next strClip = strClip & vbCr Next .Clip = strClip End With End Sub Private Sub EditSelectAll() 'Selects the whole Grid With MSFlexGrid1 .Visible = False .row = 1 .col = 1 .RowSel = .Rows - 1 .ColSel = .Cols - 1 .TopRow = 1 .Visible = True End With End Sub |
Cut, Copy, and Paste for MSFlexGrid Control |