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

Triggering a Macro for Drop-Down List Changes

Excel 97 has a bug that causes the Worksheet_Calculate event not to trigger when someone picks a value from a data ...

Discover More

Ignoring Smart Quotes when Comparing Text

When comparing two pieces of text, you may find that Word's smart quotes can mess up the comparison. Here's a quick way ...

Discover More

Spacing Table Rows Vertically

Want to get just the right amount of spacing above and below text in a table cell? A very easy way to do this is to ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Opening a Workbook and Suppressing Automatic Macros

Want to stop Excel from running any automatic macros that may be stored with a workbook? Here's how to do it.

Discover More

Determining Differences Between Dates

Macros are often used to process the data in a worksheet. If that data includes dates that need to be processed, you'll ...

Discover More

Converting Strings to Numbers

When working with data in a macro, there are two broad categories you can manipulate: numbers and text. Sometimes 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 eight minus 1?

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.