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.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

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

Printing Color Separations with VBA

When printing in color (at a commercial printer) it is necessary to print different colors of your document in different ...

Discover More

Adding Text to a Drawing Shape

You can add text to all sorts of drawing shapes, not just text boxes. Here's how easy it is.

Discover More

Hyperlinks No Longer Work in a Workbook

Hyperlinks can be a great timesaver and very convenient. Unless, of course, if they don't work as you expect. This tip ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Calculating Only the Active Workbook

When you enter information into a workbook, Excel automatically recalculates every worksheet in every open workbook on ...

Discover More

Selecting Visible Cells in a Macro

Many times you need to select just the visible cells before taking some action. It is helpful to know how to make this ...

Discover More

Creating a Floating Macro Button

Macros can make your use of Excel much more powerful. If you have a macro that is triggered by an on-screen button, you ...

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 5 + 9?

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.