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)

5

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

Creating a Bibliography from Footnotes

Most scholarly papers need to have both footnotes and a bibliography. The two are closely related, as they provide ...

Discover More

Inserting a Cross-Reference to Text

Cross-referencing is a great feature of Word that allows you to add references to text in various places of your ...

Discover More

Resizing a Disk Partition

Windows provides you with the built-in tools to change the size of partitions on your hard drives. Here's how to use the ...

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)

Telling which Worksheets are Selected

If your macro processes information on a number of worksheets, chances are good that you need your macro to figure out ...

Discover More

Creating a Plus/Minus Button

Want a quick way to convert positive values to negative and vice versa? You can create your own plus/minus button by ...

Discover More

Continuing Macro Lines

Sometimes a macro command line can get very, very long. This can make it hard to understand when you look at it a month ...

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 five more than 3?

2019-03-02 21:24:27

murray cooper

I really enjoy the tips you offer. They are practical and insightful, imo.
With respect the above tip : "Hiding Excel in VBA"
If one's code was to end or fatal or just suffered a power loss, is it only this application that is potentially lost or will it affect Excel permanently &/or other resident excel applications, please?
Just wondering, BEFORE I start using it ... it appears very dangerous ...
Thank you


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.