This subroutine processes the cut, copy and paste commands.
Posted on January 4, 2009
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 |
Related posts:
- How to enable or disable the Cut, Copy and Paste menus in Edit menu if the text selected or not in a control.
- How to copy/cut the content of the text box to the clipboard
- How to enable/disable submenus of Edit menu (Copy, Cut, Clear, Undo, and so on) based on text selection
- How to Copy and Paste the Picture
- How to set text into Clipboard
- How to Paste the Picture from PictureBox/Clipboard to Rich Text Box
- How to Copy data from an Access database into an Excel spreadsheet using a SQL SELECT statement
- How to keep your Background Processes running when displaying Message Box
- How to find out how the form is unloading
- Form Text Box Control Navigation