logo
search
VBA & Macro Problems

Fix Excel VBA Code Not Running and Form Buttons Disabled

Maira MehtabMaira Mehtab Sep 21, 2026 870 views

Question details

The user needs to resolve an issue where Excel VBA scripts fail to execute and custom form buttons remain disabled after entering login credentials.

Product
Microsoft Excel
Device & OS
not provided
Scenario
Opening and signing into an Excel workbook that features a custom VBA login form and interactive buttons.
Observed behavior
After successfully logging into the workbook, essential buttons such as Save, Reset, and Delete are grayed out, and VBA code fails to run in any open workbook.
Before you start

Before troubleshooting, ensure that you trust the source of the Excel workbook, as enabling macros and VBA code from unknown sources can pose a significant security risk to your computer.

Solution 1Recommended

Verify and Update Excel Trust Center Macro Settings

Often, VBA code and custom buttons are disabled because Excel's built-in security settings are configured to block all macros by default.

If macros are disabled at the application level, any initialization code designed to unlock the workbook or enable form buttons after login will fail to execute.

1
Open Excel Options

Click on the 'File' tab (or the Office Button in older versions like 2007) and select 'Options' at the bottom of the menu.

2
Navigate to Trust Center

In the Excel Options dialog, select 'Trust Center' from the left-hand pane, then click the 'Trust Center Settings' button.

3
Enable Macros

Go to 'Macro Settings' and choose 'Disable all macros with notification' (recommended) or 'Enable all macros'. Click 'OK' to save changes, then close and reopen the workbook.

Macro Notification Strip: If you chose 'Disable with notification', remember to click 'Enable Content' on the yellow security warning bar that appears below the ribbon when opening the file.
Free Microsoft Office alternative

Try WPS Office for Seamless Spreadsheet Management

If you are experiencing persistent macro errors, compatibility issues, or complex workbook security problems in older versions of Excel, consider switching to WPS Office. It provides a lightweight, modern interface with robust spreadsheet capabilities.

  1. 1. Download WPS Office: Visit the official WPS website to download and install the free office suite on your device.
  2. 2. Open Your Spreadsheet: Launch WPS Spreadsheets and open your .xlsx or .xlsm file directly to view your data.
  3. 3. Manage Your Data: Enjoy a smooth, secure, and familiar spreadsheet environment for all your daily tasks.
Free and lightweight office suite with fast startup timesHighly compatible with Microsoft Excel (.xlsx, .xlsm) and CSV formatsFamiliar user interface ensuring a seamless migration with zero learning curveBuilt-in PDF conversion and cross-device cloud synchronization
microsoft office alternative - wps office

Frequently Asked Questions

Why are my form buttons grayed out in Excel?

Form buttons typically appear grayed out or disabled if the workbook's macros are restricted by the Trust Center settings, or if the VBA code explicitly disables them upon startup until a specific condition (like a successful login) is met.

Does enabling macros apply to all workbooks?

Depending on your Trust Center settings, you can enable macros for all workbooks universally, or choose to be prompted for each individual workbook. For security reasons, it is highly recommended to enable them on a per-workbook basis using the notification prompt.

How do I access the VBA Editor to check the code?

You can open the VBA Editor in Excel by pressing the Alt + F11 keys on your keyboard. From there, you can view the code behind UserForms and Modules to debug why your buttons remain disabled.

Why would VBA code stop running in all open workbooks?

If a poorly written VBA script enters an infinite loop, crashes without proper error handling, or modifies application-level settings (like Application.EnableEvents = False), it can cause VBA execution to halt or malfunction across all currently open Excel workbooks.