ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I "park" a UserForm? (https://www.excelbanter.com/excel-programming/330144-can-i-park-userform.html)

Ed

Can I "park" a UserForm?
 
I call a UserForm as vbModeless so I can use the info in the Form in
different windows. If it's possible, I'd like to put a button on it that
will shrink the Form very small and "park" it in a corner of the application
window out of the way. The idea is to have it just big enough to show a
"Restore" button that will put it back at full size and "float" mode.

Can this be done?

Ed



Bob Phillips[_6_]

Can I "park" a UserForm?
 
A form has Top, Left, Width and Height properties. Have a play with these.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ed" wrote in message
...
I call a UserForm as vbModeless so I can use the info in the Form in
different windows. If it's possible, I'd like to put a button on it that
will shrink the Form very small and "park" it in a corner of the

application
window out of the way. The idea is to have it just big enough to show a
"Restore" button that will put it back at full size and "float" mode.

Can this be done?

Ed





Michel Pierron

Can I "park" a UserForm?
 
Hi Ed,
In the UserForm module:
Private Declare Function SetWindowLong& _
Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd&, ByVal nIndex&, ByVal wNewWord&)
Private Declare Function FindWindow& _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String _
, ByVal lpWindowName As String)

Private Sub UserForm_Initialize()
Dim hwnd&
hwnd = FindWindow(vbNullString, Me.Caption)
SetWindowLong hwnd, -16, &H84CA0080
End Sub

MP

"Ed" a écrit dans le message de news:
...
I call a UserForm as vbModeless so I can use the info in the Form in
different windows. If it's possible, I'd like to put a button on it that
will shrink the Form very small and "park" it in a corner of the

application
window out of the way. The idea is to have it just big enough to show a
"Restore" button that will put it back at full size and "float" mode.

Can this be done?

Ed





Ed

Can I "park" a UserForm?
 
Thank you, Bob. I'll do that - and yell for help if I can't find it
anymore! 8{
Ed

"Bob Phillips" wrote in message
...
A form has Top, Left, Width and Height properties. Have a play with these.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ed" wrote in message
...
I call a UserForm as vbModeless so I can use the info in the Form in
different windows. If it's possible, I'd like to put a button on it

that
will shrink the Form very small and "park" it in a corner of the

application
window out of the way. The idea is to have it just big enough to show a
"Restore" button that will put it back at full size and "float" mode.

Can this be done?

Ed







Ed

Can I "park" a UserForm?
 
Thank you, Michel. But I must admit, though, I don't know what to do with
this. Is SetWindowLong the value I need to restore the UserForm after
resizing and repositioning?

Ed

"Michel Pierron" wrote in message
...
Hi Ed,
In the UserForm module:
Private Declare Function SetWindowLong& _
Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd&, ByVal nIndex&, ByVal wNewWord&)
Private Declare Function FindWindow& _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String _
, ByVal lpWindowName As String)

Private Sub UserForm_Initialize()
Dim hwnd&
hwnd = FindWindow(vbNullString, Me.Caption)
SetWindowLong hwnd, -16, &H84CA0080
End Sub

MP

"Ed" a écrit dans le message de news:
...
I call a UserForm as vbModeless so I can use the info in the Form in
different windows. If it's possible, I'd like to put a button on it

that
will shrink the Form very small and "park" it in a corner of the

application
window out of the way. The idea is to have it just big enough to show a
"Restore" button that will put it back at full size and "float" mode.

Can this be done?

Ed







Tom Ogilvy

Can I "park" a UserForm?
 
Put the code in the userform module like Michel said.

This will put a minimize/maximize button on the top right of your userform
which the user will then manipulate manually. (which appeared to be what
you were asking for).

--
Regards,
Tom Ogilvy

"Ed" wrote in message
...
Thank you, Michel. But I must admit, though, I don't know what to do with
this. Is SetWindowLong the value I need to restore the UserForm after
resizing and repositioning?

Ed

"Michel Pierron" wrote in message
...
Hi Ed,
In the UserForm module:
Private Declare Function SetWindowLong& _
Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd&, ByVal nIndex&, ByVal wNewWord&)
Private Declare Function FindWindow& _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String _
, ByVal lpWindowName As String)

Private Sub UserForm_Initialize()
Dim hwnd&
hwnd = FindWindow(vbNullString, Me.Caption)
SetWindowLong hwnd, -16, &H84CA0080
End Sub

MP

"Ed" a écrit dans le message de news:
...
I call a UserForm as vbModeless so I can use the info in the Form in
different windows. If it's possible, I'd like to put a button on it

that
will shrink the Form very small and "park" it in a corner of the

application
window out of the way. The idea is to have it just big enough to show

a
"Restore" button that will put it back at full size and "float" mode.

Can this be done?

Ed









Ed

Can I "park" a UserForm?
 
Thank you for the explanation, Tom. I did put the code in, but didn't
notice anything happening - even when using the form later! Now that you
point it out, yes, there is a minimize/maximize button, and it does work
just right.

Ed

"Tom Ogilvy" wrote in message
...
Put the code in the userform module like Michel said.

This will put a minimize/maximize button on the top right of your userform
which the user will then manipulate manually. (which appeared to be what
you were asking for).

--
Regards,
Tom Ogilvy

"Ed" wrote in message
...
Thank you, Michel. But I must admit, though, I don't know what to do

with
this. Is SetWindowLong the value I need to restore the UserForm after
resizing and repositioning?

Ed

"Michel Pierron" wrote in message
...
Hi Ed,
In the UserForm module:
Private Declare Function SetWindowLong& _
Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd&, ByVal nIndex&, ByVal wNewWord&)
Private Declare Function FindWindow& _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String _
, ByVal lpWindowName As String)

Private Sub UserForm_Initialize()
Dim hwnd&
hwnd = FindWindow(vbNullString, Me.Caption)
SetWindowLong hwnd, -16, &H84CA0080
End Sub

MP

"Ed" a écrit dans le message de news:
...
I call a UserForm as vbModeless so I can use the info in the Form in
different windows. If it's possible, I'd like to put a button on it

that
will shrink the Form very small and "park" it in a corner of the
application
window out of the way. The idea is to have it just big enough to

show
a
"Restore" button that will put it back at full size and "float"

mode.

Can this be done?

Ed












All times are GMT +1. The time now is 10:48 PM.

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