View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default 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