VBA & Macro Problems

How to Show a Hidden VBA Menu Button When an Excel Workbook Opens

John WilsonJohn Wilson Nov 11, 2026 868 views

Question details

The user needs to automatically display a hidden VBA menu button or shape when a macro-enabled workbook is opened.

How to Show a Hidden VBA Menu Button When a Workbook Opens
Product
Excel / WPS Spreadsheet
Device & OS
not provided
Scenario
Extending the expiration dates in a macro-enabled workbook and needing the navigation menu or shape buttons to reappear automatically upon launching the file.
Observed behavior
The menu button remains hidden upon opening the workbook, even after the expiration dates in the VBA code have been updated to future dates.
Before you start

Ensure that macros are fully enabled in your spreadsheet's Trust Center settings, and verify the exact name of both the target worksheet and the shape you intend to unhide.

Solution 1Recommended

Add Visibility Code to the Workbook_Open Event

Modify the VBA code triggered when the workbook opens to explicitly set the menu button's visibility property to true.

The most reliable way to ensure a specific button or shape is visible upon launching your file is to tie its Visible property to the Workbook_Open event. This overrides any previous hidden states saved when the file was last closed.

1
Open the VBA Editor

Press ALT + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.

2
Access the ThisWorkbook Module

In the Project Explorer pane on the left, locate your current workbook and double-click on 'ThisWorkbook'.

3
Locate or Create the Open Event

From the left dropdown at the top of the code window, select 'Workbook'. From the right dropdown, select 'Open'. This will generate the Private Sub Workbook_Open() block.

4
Insert the Visibility Code

Inside the Workbook_Open subroutine, type the following code: Sheets("Instructions").Shapes("menuButton").Visible = True. Ensure you replace "Instructions" and "menuButton" with your actual sheet name and shape name.

5
Save and Test

Save the file immediately as a Macro-Enabled Workbook (.xlsm), close it, and reopen it to verify that the menu button appears as expected.

Add Visibility Code to the Workbook_Open Event
Save After Editing Dates: If your macro relies on expiration dates, ensure you have edited the dates to future values and immediately saved the workbook before testing.
Advanced Macro Support

Use WPS Spreadsheet to Manage VBA and Macros Seamlessly

WPS Office provides robust support for VBA macros in its Spreadsheet application. You can easily edit Workbook_Open events, manage interactive shapes, and run automated scripts just like you do in Microsoft Excel.

  1. 1. Open Your Macro Workbook: Launch WPS Spreadsheet and open your existing .xlsm file.
  2. 2. Access the Developer Tools: Navigate to the 'Developer' tab on the top ribbon and click on 'VBA Editor'.
  3. 3. Edit the Workbook Event: Double-click 'ThisWorkbook' in the Project Explorer, insert your shape visibility code into the Workbook_Open event, and save the file.
Fully compatible with Microsoft Excel (.xlsm) macro-enabled formatsBuilt-in VBA editor for writing, editing, and debugging macrosLightweight application that opens large, macro-heavy workbooks quicklyFamiliar ribbon interface reduces the learning curve for advanced users
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the Workbook_Open event trigger when I open the file?

This usually happens if macros are disabled by your security settings. Check your Trust Center or Macro Security settings to ensure macros are enabled, or look for a security warning bar below the ribbon and click 'Enable Content'.

How do I find the exact name of my shape or menu button?

Click on the shape in your worksheet, then look at the Name Box located immediately to the left of the formula bar. You can also rename the shape directly from this box by typing a new name and pressing Enter.

Can I hide the button again automatically when the workbook closes?

Yes. You can add the line Sheets("Instructions").Shapes("menuButton").Visible = False into the Private Sub Workbook_BeforeClose(Cancel As Boolean) event located in the 'ThisWorkbook' module.