ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   differentiate between a visible and a hidden userform (https://www.excelbanter.com/excel-programming/333354-differentiate-between-visible-hidden-userform.html)

RB Smissaert

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

Tom Esh

differentiate between a visible and a hidden userform
 
On Thu, 30 Jun 2005 21:25:48 +0100, "RB Smissaert"
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)

RB Smissaert

differentiate between a visible and a hidden userform
 
Thanks, nice and simple and it exactly does the job.

RBS


"Tom Esh" wrote in message
...
On Thu, 30 Jun 2005 21:25:48 +0100, "RB Smissaert"
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)




All times are GMT +1. The time now is 12:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com