Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. 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.
Written by Allen Wyatt (last updated August 21, 2021)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365
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:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10945) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Hiding Excel in VBA.
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!
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 MoreWant 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 MoreIf you have a range of cells in which you want to count all the commas, there are several ways you can derive the figure ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2021-08-21 10:49:01
SJO
Interesting tip. Question: If you use VBA to completely "hide" Excel so that the user never sees it, what does the user see on screen? How exactly does that work? Does this work as an Excel add-in?
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments