minimize a worksheet when form opens

arey

Board Regular
Joined
Feb 14, 2006
Messages
166
Hello all,

I have to questions...

1. I have a form that I setup to open when my excel db is opened. How do I get the excel db to minimize or hide so that only the form is open.

2. How to I add minimize and maximize buttons to the forms I have created?



Thanks,
T.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
For minimize buttons check out this:

http://www.oaltd.co.uk/Excel/Default.htm

For the window
I use this

Code:
Try this to hide the application and display the UserForm
[code]
Option Explicit

Sub ShowForm()
Application.Visible = False
UserForm1.Show
End Sub

'make dure you put this code into the UserForm Query_Close

Option Explicit

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.Visible = True
End Sub
[/code]
 
Upvote 0
thanks for replying.
Im just getting around to trying this.
Its not working for me and i think its because i forgot to mention that im new at vba.
So im not sure where to place the codes.

I this in General - showforms:

Sub ShowForm()
Application.Visible = False
frmGlobalInterface.Show
End Sub

I right clicked on the form and inserted a module and pasted this:

Option Explicit

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.Visible = True
End Sub


Can you tell me what I am doing wrong.

Thanks again.
 
Upvote 0
Add a button on your worksheet from the forms toolbar ( View - toolbars - forms ) then assign this macro (insert as a normal module)

Code:
Option Explicit

Sub ShowForm()
Application.Visible = False
UserForm1.Show
End Sub

Then, in your form just doubleclick anywhere and add this

Code:
Option Explicit

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.Visible = True
End Sub

If your stuck, send me a copy of your sheet (anonimise where possible) using the link in my signature below and i´ll try to help.
 
Upvote 0
i thin ki see where you're going with this BUT...

I have the form automatically opening when i open the workbook.
I added this code to achieve this.

Private Sub Workbook_Open()
frmGlobalInterface.Show
End Sub

Now what I want is when my form opens, the workbook to minimize.

Any clearer?
 
Upvote 0
Try this

Code:
Private Sub Workbook_Open()
frmGlobalInterface.Show
Application.Visible = False
End Sub
 
Upvote 0
If i did it correctly it didnt work.
All I did was add one line from your code to mine...


Application.Visible = False


Yes?
 
Upvote 0
sorry about the late response. I went to lunch.

That does seem to work either.
 
Upvote 0

Forum statistics

Threads
1,203,683
Messages
6,056,730
Members
444,887
Latest member
cvcc_wt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top