Consulting

Results 1 to 4 of 4

Thread: Handle to userform

  1. #1
    VBAX Regular
    Joined
    Aug 2004
    Location
    London, England
    Posts
    52
    Location

    Handle to userform

    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?

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    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
    K :-)

  3. #3
    BoardCoder
    Licensed Coder
    VBAX Expert mark007's Avatar
    Joined
    May 2004
    Location
    Leeds, UK
    Posts
    622
    Location
    "Computers are useless. They can only give you answers." - Pablo Picasso
    Mark Rowlinson FIA | The Code Net

  4. #4
    VBAX Regular
    Joined
    Aug 2004
    Location
    London, England
    Posts
    52
    Location
    thanks very much guys, both your answers came in very handy!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •