How to Undo the last User Action in Text Box
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 'Controls - How to Undo the last User Action in Text Box Option Explicit 'The user can undo his last editing in a text box via the Undo item on the text 'box pop up menu. You can do the same through code. 'Add a Text Box and a Command Button to your form. Click the button to undo the last user action. Declare Function SendMessageBynum& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _ ByVal wMsg As Long, ByVal wParam As Long, ByVal lparam As Long) Public Const EM_UNDO = &HC7& Private Sub TextUndo(T As TextBox) SendMessageBynum T.hwnd, EM_UNDO, 0, 0 End Sub Private Sub Command1_Click() Call TextUndo(Text1) End Sub |