Home > How-To Library > Forms
This subroutine processes the cut, copy and paste commands.
**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * **************************************************************** '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
If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.