Results 1 to 2 of 2

Thread: Obtaining VBA control handles

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Fountain Valley, CA
    Posts
    6

    Obtaining VBA control handles

    Seeing as API calls require object handles to be passed as arguments, VB makes this easy by exposing the hWnd property for most controls(windows). There is no hWnd property in VBA however.

    I have been able to use the FindWindow API call to obtain a pointer to my VBA UserForms:
    ------------------------------------------------
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

    lngHwnd = FindWindow(vbNullString, Me.Caption)
    ------------------------------------------------
    I cannot get this to work for any other controls besides the UserForm. Is there a way to obtain VBA control handles?
    Mark Sanchez
    SPEC Services, Inc.
    Fountain Valley, CA USA

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Do VBA Controls have handles?

Posting Permissions

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



Click Here to Expand Forum to Full Width