hidding xl workbooks

kxlvba

New Member
Joined
Jun 11, 2006
Messages
43
Same here I have a different issue. I'm using the following code to hide and show the excel file. For me I need to have the control to hide and show the excel file after doing something on a userform.
Using Application.Visible = True / False hides all workbooks. I just need to hide the workbook which has the form and keep rest of the open workbooks open. Any advice.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,884
Hi kxlvba

You can use the window's visible property.

Try this code:

Code:
Sub HideWindow()
Dim wnd As Window

Set wnd = ActiveWindow
wnd.Visible = False
MsgBox "The window is hidden"
wnd.Visible = True

End Sub

Does this help?
PGC
 

kxlvba

New Member
Joined
Jun 11, 2006
Messages
43
No, I have an excel file..where I've placed a button to show the form. So once the form is up, Application.Visible = False is executed within the click code and hides all excel files.
Then when I'm through filling the form and click on Close the code Application.Visible = False is executed and shows all workbooks.
So if I use the above code, after the workbook gets hidden it doesn't proceeds ahead with the remaining macro code. Gives me a runtime error 1004.
So, there should be something related to Application.Visible...which should only hide a particular workbook.
 
L

Legacy 98055

Guest
You cannot hide a workbook. There is no visible property of a workbook. If you hide the application, you will hide everything it contains. You need to work in several instances of Excel which may be possible if a bit tricky. See this post and others.

Opening xl in hidden mode via VBS script
 

Forum statistics

Threads
1,136,702
Messages
5,677,290
Members
419,684
Latest member
BOB101

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
Top