Excel

Hiding Command Bars and other Excel Workbook Characteristics

Ease of Use

Intermediate

Version tested with

2003 

Submitted by:

Paleo

Description:

This code hides Command Bars, Formula Bar and Headings. Also changes the application Caption. 

Discussion:

Sometimes we create applications in Excel where we don't want the user to actually know he is working in Excel, then we want to hide some Excel characteristics. This is what this code does. 

Code:

instructions for use

			

Private Sub Workbook_Activate() Call Desliga End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Call Liga End Sub Private Sub Workbook_Deactivate() Call Liga End Sub Private Sub Workbook_Open() Call Desliga End Sub Sub Desliga() Dim cbars As CommandBar Application.ScreenUpdating = False For Each cbars In Application.CommandBars cbars.Enabled = False Next With ActiveWindow .DisplayHeadings = False .Zoom = 80 End With With Application .DisplayFormulaBar = False .Caption = "Aplica??o do Carlos" .ScreenUpdating = True End With End Sub Sub Liga() Dim cbars As CommandBar Application.ScreenUpdating = False ActiveWindow.Zoom = 100 For Each cbars In Application.CommandBars cbars.Enabled = True Next ActiveWindow.DisplayHeadings = True With Application .DisplayFormulaBar = True .Caption = "Microsoft Excel" .ScreenUpdating = True End With End Sub

How to use:

  1. Copy the above code.
  2. Open any workbook.
  3. Press Alt + F11 to open the Visual Basic Editor (VBE).
  4. From the Menu, double click This_Workbook
  5. Paste the code into the right-hand code window, except Subs Liga and Desliga, these must be pasted at Module 1. (To create it select Insert -> New module)
  6. Close the VBE, save the file if desired.
  7. Close the workbook
 

Test the code:

  1. Open the workbook
 

Sample File:

HideAndShowCommandBars.zip 7.9KB 

Approved by mdmackillop


This entry has been viewed 204 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express