This subroutine processes the cut, copy and paste commands.
Posted on September 13, 2011
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 'Forms - This subroutine processes the cut, copy and paste commands. 'Function: CutCopyPaste(DoWhat As Integer) 'Description: This sub processes the cut, copy and paste commands. 'Parameters: 0=cut, 1=copy, 2=paste, 3=delete 'Notes: 'Returns: Nothing Sub CutCopyPaste(DoWhat As Integer) ' ActiveForm refers to the active form in the MDI form. If TypeOf Screen.ActiveControl Is TextBox Then Select Case DoWhat Case 0 ' Cut. ' Copy selected text to Clipboard. Clipboard.SetText Screen.ActiveControl.SelText ' Delete selected text. Screen.ActiveControl.SelText = "" Case 1 ' Copy. ' Copy selected text to Clipboard. Clipboard.SetText Screen.ActiveControl.SelText Case 2 ' Paste. ' Put Clipboard text in text box. Screen.ActiveControl.SelText = Clipboard.GetText() Case 3 ' Delete. ' Delete selected text. Screen.ActiveControl.SelText = "" End Select End If End Sub |