Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 214
Default 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




  #3   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, 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






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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








  #5   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












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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




  #7   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, 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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Excel 2000 crashes after "touching" a userform with the mouse and closing it Chris J Mercer Excel Programming 0 October 1st 03 08:41 AM


All times are GMT +1. The time now is 07:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"