Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default VBA - need to minimize Excel from UserForm

I have a VBA application that displays a UserForm that has a Minimize button
on it. When I click it, the UserForm minimizes as it should but the Excel
workbook that contains the UserForm does not. I can not even click on the
minimize button on the workbook because it is grayed out (I think because the
UserForm has focus).

How do I make the Excel workbook that contains the UserForm that was
launched also minimize when I minimize the UserForm?

Thanks,

Gary

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default VBA - need to minimize Excel from UserForm

to the best of my knowledge, no event is fired when a userform is minimized,
so you probably should hide the application when the form is shown and
display it when it is hidden or unloaded.

--
Regards,
Tom Ogilvy


"gary" wrote:

I have a VBA application that displays a UserForm that has a Minimize button
on it. When I click it, the UserForm minimizes as it should but the Excel
workbook that contains the UserForm does not. I can not even click on the
minimize button on the workbook because it is grayed out (I think because the
UserForm has focus).

How do I make the Excel workbook that contains the UserForm that was
launched also minimize when I minimize the UserForm?

Thanks,

Gary

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default VBA - need to minimize Excel from UserForm

Hi Gary,

gary wrote:
I have a VBA application that displays a UserForm that has a Minimize
button on it. When I click it, the UserForm minimizes as it should


First of all - how are you adding a minimize button on the UserForm? Is it
custom code that resizes the UserForm?

but the Excel workbook that contains the UserForm does not. I can
not even click on the minimize button on the workbook because it is
grayed out (I think because the UserForm has focus).


I don't think you'll be able to minimize the Excel application window unless
the UserForm was shown modelessly:

UserForm1.Show vbModeless

How do I make the Excel workbook that contains the UserForm that was
launched also minimize when I minimize the UserForm?


If your code to minimize the UserForm is resizing it, you could try using
the Resize event of the UserForm.

Private Sub UserForm_Resize()
Application.WindowState = xlMinimized
End Sub

If you are using API calls to minimize the UserForm, I'm not sure that the
Resize event will fire when it's minimized. You would probably have to trap
the event using more API calls, but I'm not sure about that.

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 214
Default VBA - need to minimize Excel from UserForm

Hi gary,
Private Declare Function IsIconic& Lib "user32" (ByVal hWnd&)

Private Sub UserForm_Resize()
Dim s&: s = Application.WindowState
Dim h&: h = FindWindow(vbNullString, Application.Caption)
If IsIconic(hWnd) Then
Application.WindowState = xlMinimized
Else
Application.WindowState = s
End If
End Sub

MP

"gary" a écrit dans le message de news:
...
I have a VBA application that displays a UserForm that has a Minimize
button
on it. When I click it, the UserForm minimizes as it should but the Excel
workbook that contains the UserForm does not. I can not even click on the
minimize button on the workbook because it is grayed out (I think because
the
UserForm has focus).

How do I make the Excel workbook that contains the UserForm that was
launched also minimize when I minimize the UserForm?

Thanks,

Gary



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
Minimize button on userform? Bob Excel Discussion (Misc queries) 3 June 13th 09 11:01 PM
Minimize UserForm Howard31 Excel Discussion (Misc queries) 0 December 17th 08 09:10 PM
USERFORM DISAPPEARS ON EXCEL MINIMIZE Ian Digby[_3_] Excel Programming 2 January 25th 06 08:50 AM
Minimize a UserForm SailFL Excel Discussion (Misc queries) 1 August 21st 05 12:45 AM
How to minimize a userform! furbiuzzu Excel Programming 4 June 15th 05 07:46 PM


All times are GMT +1. The time now is 07:56 AM.

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

About Us

"It's about Microsoft Excel"