VBA need to minimize Excel from UserForm

G

gary

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
 
K

Karl E. Peterson

gary said:
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).

One old trick is to parent the form to the one you want to go down with it.
Kind of conterintuitive, as you don't use Set/GetParent, but
Set/GetWindowLong and GWL_OWNER. That'd probably work automagically. The
other alternative would be to handle it all manually, by calling ShowWindow
against Excel when you detect your own WindowState has changed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top