ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Special modeless "Userform" object.... (https://www.excelbanter.com/excel-programming/435552-special-modeless-userform-object.html)

Robert Crandal

Special modeless "Userform" object....
 
I know this is far-fetched, but is there any way to create a
modeless Userform that stays visible somewhere on the
desktop even when the Excel application is minimized on the
taskbar???

Thank you everyone!



Patrick Molloy[_2_]

Special modeless "Userform" object....
 
I don't think so, but you make the application's visible property False - ie
hide excel

"Robert Crandal" wrote:

I know this is far-fetched, but is there any way to create a
modeless Userform that stays visible somewhere on the
desktop even when the Excel application is minimized on the
taskbar???

Thank you everyone!


.


Peter T

Special modeless "Userform" object....
 
' be sure to show the form as modeless, eg in normal module
' UserForm1.Show vbModeless

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLongA Lib "user32" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Const GWL_HWNDPARENT As Long = -8

Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindow("ThunderDFrame", Me.Caption)
SetWindowLongA hWnd, GWL_HWNDPARENT, 0&
End Sub

Search this group if you want to put minimize/restore buttons in the
caption.

Regards,
Peter T


"Robert Crandal" wrote in message
...
I know this is far-fetched, but is there any way to create a
modeless Userform that stays visible somewhere on the
desktop even when the Excel application is minimized on the
taskbar???

Thank you everyone!





Robert Crandal

Special modeless "Userform" object....
 
Wow, that code works great..... thanx soooo much

"Peter T" <peter_t@discussions wrote in message
...
' be sure to show the form as modeless, eg in normal module
' UserForm1.Show vbModeless

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLongA Lib "user32" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Const GWL_HWNDPARENT As Long = -8

Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindow("ThunderDFrame", Me.Caption)
SetWindowLongA hWnd, GWL_HWNDPARENT, 0&
End Sub

Search this group if you want to put minimize/restore buttons in the
caption.

Regards,
Peter T


"Robert Crandal" wrote in message
...
I know this is far-fetched, but is there any way to create a
modeless Userform that stays visible somewhere on the
desktop even when the Excel application is minimized on the
taskbar???

Thank you everyone!







All times are GMT +1. The time now is 08:21 AM.

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