Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Hiding Excel in VBA.

Hiding Excel in VBA

by Allen Wyatt
(last updated November 29, 2014)

4

Many macros are written to perform a specific, limited task. Other macros are written as part of a larger, overall application designed to be used start-to-finish by a user. For instance, I have seen accounting packages written completely in Excel VBA. The functions of the accounting package are written in VBA, of course. The user of the accounting package never uses "regular Excel," but instead utilizes menus, dialog boxes, and choices presented exclusively by the VBA application.

If you are writing an application in VBA, you may need a way to completely "hide" Excel so that the user never sees it. To do so, you can use this code in a macro:

Application.Visible = False

If your application ends without exiting Excel (such as if an error is encountered), it is important that you set the Visible property to True. If you don't, Excel will remain in memory, but the user will never see it. The user cannot set this property; it must be done under macro control.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10945) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Hiding Excel in VBA.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

The Last Business Day

Many businesses need to know when the last business day of the month occurs. This tip discusses several ways you can ...

Discover More

Skipping Hidden Rows in a Macro

As your macro processes information in a worksheet, you may want to make sure that it skips over rows that are hidden. The ...

Discover More

Enabling Filters by Default

Filtering can be a powerful way to work with large amounts of data in a worksheet. If you use filtering quite a bit, you may ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Tools on Developer Tab are Unavailable

Want to add some macros to your workbook? What do you do if you try to add the macros but the program has disabled the tools?

Discover More

Running a Procedure when a Workbook is Opened

Ever want to have Excel run a procedure whenever you open a workbook? It's not as difficult as you might think. Here's how.

Discover More

Switching Windows in a Macro

When you have multiple workbooks open at the same time, Excel allows you to easily switch between those workbooks. How you do ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 6?

2015-04-08 14:28:25

weliton

Remove the Personal.xlsb folder of the project explorer. Leave only the macros and forms of their projects. In 2010 is not necessary. More in Excel 2013 is necessary - AND MORE OR LESS BY AI. This prevented me that Excel created other instances of it. With me, it was perfect.


2014-12-01 07:44:26

balthamossa2b

@Ken

I just tried it on XP/Excel 2010, and no other sessions were created.

If I had to guess, it's probably an addin/personal book macro doing funny stuff on the background.

Kill them and try again.


2014-12-01 01:07:20

Ken

Hi Allen,
I thought this might come in handy for me so I tried it.
I created a new empty workbook, recorded a simple macro (see below) then used the F8 function to step my way through it.

The first step was fine ... the selected cell became C11, then the second step made the excel application disappear, then I suspect the third step worked ... but I couldnt see that yet, then I expected the fourth step to bring excel back to me visible again with the selected cell being C21.
It did ... but it created 3 other excel sessions without workbooks in them and the only way I can close them is to 'end' them in task manager.
Would you know why this is behaving in such a way?
Thanks, Ken
===============================
Sub Macro1()
'
' Macro1 Macro
'
Range("C11").Select
Application.Visible = False
Range("C21").Select
Application.Visible = True
End Sub
===============================


2014-11-30 20:58:06

Paul

Thanks Allen!
Might also be pertinent in the context of this tip to point to your tips on
- precautions on setting passwords for workbooks; and
- how to create and bypass auto-open macros

to avoid beginners locking themselves out of their own applications.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.