|
-
Aug 31st, 2001, 04:19 PM
#1
Thread Starter
New Member
Get VBA control handle : FindWindow(Ex)
I currently use code in a VB project to allow Undo capability for a multi-line text box. I am trying to do the same for a multi-line text box in VBA.
My problem is that the text box in VBA does not have a handle property. I have successfully used the API FindWindow function to return the VBA UserForms handle. I've had no luck though, using FindWindowEx in an attempt to get the child windows (text box) handle. I need this to replace the lines noted below. Don't I?
'***********************************************
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_CANUNDO = &HC6
Private Const EM_UNDO = &HC7
Private Sub Command1_Click()
Dim blnCanUndo As Boolean
Dim lngUndo As Long
blnCanUndo = CanBeUndone
If blnCanUndo = True Then
'??? What's the VBA equivalent of Text1.hwnd below?
lngUndo = SendMessage(Text1.hwnd, EM_UNDO, 0&, 0&)
Else
MsgBox "Nothing to be undone!"
End If
End Sub
Private Function CanBeUndone() As Boolean
Dim lngRet As Long
'??? What's the VBA equivalent of Text1.hwnd below?
lngRet = SendMessage(Text1.hwnd, EM_CANUNDO, 0&, 0&)
CanBeUndone = (lngRet <> 0)
End Function
Mark Sanchez
SPEC Services, Inc.
Fountain Valley, CA USA
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|