+ Reply to Thread
Results 1 to 3 of 3

differentiate between a visible and a hidden userform

  1. #1
    RB Smissaert
    Guest

    differentiate between a visible and a hidden userform

    In Excel VBA is there a way to detect with the API if an Excel userform
    is hidden or visible?
    There is no problem to get the Window handle, but I can't figure this out.
    Have tried with a few GetWindow... API's, but no success sofar.
    As the code is in one workbook and the userform is in another I can't do
    this easily with VBA.

    RBS

  2. #2
    Tom Esh
    Guest

    Re: differentiate between a visible and a hidden userform

    On Thu, 30 Jun 2005 21:25:48 +0100, "RB Smissaert"
    <[email protected]> wrote:

    >In Excel VBA is there a way to detect with the API if an Excel userform
    >is hidden or visible?
    >There is no problem to get the Window handle, but I can't figure this out.
    >Have tried with a few GetWindow... API's, but no success sofar.
    >As the code is in one workbook and the userform is in another I can't do
    >this easily with VBA.


    IsWindowVisible should do it:

    Public Declare Function IsWindowVisible Lib "user32" _
    (ByVal hWnd As Long) As Long


    If IsWindowVisible(hwndFrm) <> 0 Then
    '...its visible...
    End If


    -Tom
    MVP - Visual Basic
    (please post replies to the newsgroup)

  3. #3
    RB Smissaert
    Guest

    Re: differentiate between a visible and a hidden userform

    Thanks, nice and simple and it exactly does the job.

    RBS


    "Tom Esh" <[email protected]> wrote in message
    news:[email protected]...
    > On Thu, 30 Jun 2005 21:25:48 +0100, "RB Smissaert"
    > <[email protected]> wrote:
    >
    >>In Excel VBA is there a way to detect with the API if an Excel userform
    >>is hidden or visible?
    >>There is no problem to get the Window handle, but I can't figure this out.
    >>Have tried with a few GetWindow... API's, but no success sofar.
    >>As the code is in one workbook and the userform is in another I can't do
    >>this easily with VBA.

    >
    > IsWindowVisible should do it:
    >
    > Public Declare Function IsWindowVisible Lib "user32" _
    > (ByVal hWnd As Long) As Long
    >
    >
    > If IsWindowVisible(hwndFrm) <> 0 Then
    > '...its visible...
    > End If
    >
    >
    > -Tom
    > MVP - Visual Basic
    > (please post replies to the newsgroup)



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1