PDA

View Full Version : [SOLVED:] Handle to userform



alimcpill
01-12-2005, 08:23 AM
Can anyone give me some hints on how to get a handle to a userform please? In full vb I believe you can use userform.hwnd, but this property isn't there in VBA. Will I have to make some API calls to get it?

Killian
01-12-2005, 09:24 AM
You can declare this in your user form code:


Private Declare Function GetActiveWindow Lib "user32.dll" () As Long

then get handles to it when its active with this:


dim hWnd as Long
hWnd = GetActiveWindow()


Hope that helps

mark007
01-12-2005, 02:17 PM
This should help:

http://www.thecodenet.com/articles.php?id=2

:)

alimcpill
01-13-2005, 02:02 AM
thanks very much guys, both your answers came in very handy!