ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Forms Display (https://www.excelbanter.com/excel-programming/282171-forms-display.html)

ZAK

Forms Display
 
Hi

I am displaying a warning form for a user when the cell
reaches a critical value. However I would like the form to
be at the forefront of all windows application, so that
the user has to acknowledge before he can resume to use
the computer. I am thinking in cases where the Excel is
minimised.

Regards

ZAK

Chip Pearson

Forms Display
 
Zak,

Try the following, for Excel 2000 and later.

Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Declare Function SetForegroundWindow Lib "user32" ( _
ByVal hwnd As Long) As Long

Sub ShowTheForm()
Dim FHwnd As Long
Load UserForm1
FHwnd = FindWindow("ThunderDFrame", UserForm1.Caption)
If FHwnd Then
SetForegroundWindow FHwnd
End If
UserForm1.Show
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"ZAK" wrote in message
...
Hi

I am displaying a warning form for a user when the cell
reaches a critical value. However I would like the form to
be at the forefront of all windows application, so that
the user has to acknowledge before he can resume to use
the computer. I am thinking in cases where the Excel is
minimised.

Regards

ZAK





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

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