PDA

View Full Version : Specify the position of a Minimized Userform



dlx
11-24-2010, 01:47 PM
Hi,
Excel 2003
I have added a Minimize button to a Userfom with this code
http://www.excelforum.com/excel-programming/349283-minimize-and-maximize-buttons-userforms.html

lFormHandle = FindWindow("ThunderDFrame", Me.Caption)
lStyle = GetWindowLong(lFormHandle, GWL_STYLE)
lStyle = lStyle Or WS_SYSMENU 'SystemMenu
lStyle = lStyle Or WS_MINIMIZEBOX 'With MinimizeBox
SetWindowLong lFormHandle, GWL_STYLE, (lStyle)

The form minimizes to the lower left and covers the sheet tabs.
Is there a way to specify the position of the minimized from?

Sean.DiSanti
11-29-2010, 07:28 PM
I don't believe you can change where it minimizes to, but you can hide it instead of minimizing it; maybe have a new sub:

Public Sub ToggleHide()
UserForm1.Visible = Not UserForm1.Visible
End Sub

you can set a hotkey to that, and just

Call ToggleHide()
on your minimize button. that way whether it's minimized with button or hotkey, it's not in the way, AND you can get back to it with a keystroke

Trevor
11-29-2010, 10:04 PM
I agree with sean.djsanti