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

Easily Changing Print Order

You can change the order in which pages are printed (normal or reversed) using the Print dialog box. What if you want a way ...

Discover More

Setting Prime Height Spacing in the Equation Editor

The Equation Editor is a great tool for easily creating fancy-looking equations in your document. You can even control minute ...

Discover More

Adding Leading Zeroes to ZIP Codes

Import a bunch of ZIP Codes into Excel, and you may be surprised that any leading zeroes disappear. Here's a handy little ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Dissecting a String

VBA is a versatile programming language. It is especially good at working with string data. Here are the different VBA ...

Discover More

Unprotecting Groups of Worksheets

Unprotecting a single worksheet is relatively easy. Unprotecting a whole lot of worksheets is harder. Here's how you can make ...

Discover More

Determining the Day of the Month

Want to figure out the day of the month represented by a particular date? You can use the Day function in VBA to get the ...

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 four less than 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.