logo
search
VBA & Macro Problems

Fix Excel Custom Ribbon Macro Buttons Opening the Wrong Workbook

Elise WilliamsElise Williams Sep 25, 2026 868 views

Question details

Users need to correct custom ribbon buttons that trigger macros from the original workbook instead of the current one after copying or migrating a macro-enabled file.

Fix Excel Custom Ribbon Macro Buttons Opening the Wrong Workbook
Product
Microsoft Excel
Device & OS
not provided
Scenario
Copying, renaming, or migrating a macro-enabled Excel workbook that contains user-created custom ribbon buttons.
Observed behavior
When clicking a custom ribbon button in the new workbook, Excel incorrectly opens the original file to run the macro, rather than executing the macro housed inside the current workbook.
Before you start

Ensure both your original and new workbooks are saved as Macro-Enabled Workbooks (.xlsm) and that the Developer tab is enabled in your Excel ribbon.

Solution 1Recommended

Manually Reassign Macros to Custom Ribbon Buttons

The quickest and most reliable fix is to remove the outdated ribbon buttons in the new workbook and re-add them, assigning them directly to the current workbook's macros.

When you assign a macro to a ribbon button in Excel, the application often binds it to the absolute file path of the workbook. If the workbook is duplicated or renamed, the ribbon button still looks for the original path.

1
Open Ribbon Options

Open the copied workbook in Excel. Go to 'File' in the top-left corner, select 'Options' at the bottom, and click on 'Customize Ribbon' in the left pane.

2
Remove Old Buttons

In the right-hand list (Main Tabs), locate the custom group containing your broken macro buttons. Select the faulty buttons and click the 'Remove' button in the middle column.

3
Select Current Macros

In the left-hand column under 'Choose commands from', click the dropdown menu and select 'Macros'. This will display a list of all macros available in the current workbook.

4
Add and Rename New Buttons

Select the correct macro from the list, ensure your custom group is highlighted on the right, and click 'Add'. You can click 'Rename' to give the button a user-friendly name and a custom icon.

5
Save Changes

Click 'OK' at the bottom of the Excel Options window to save your updated ribbon configuration. Test the button to ensure it runs without opening the old file.

Manually Reassign Macros to Custom Ribbon Buttons
Testing the Fix: Temporarily move or rename the original workbook before testing the new button. If it works without throwing an error, the reference is successfully updated.
Efficient Macro Management

Manage and Run VBA Macros Easily in WPS Spreadsheet

Avoid complex ribbon reference issues by utilizing WPS Spreadsheet. It provides a straightforward Developer tab to manage, edit, and run your VBA macros seamlessly, offering high compatibility with Microsoft Excel macro-enabled workbooks.

  1. 1. Open Your Workbook: Launch WPS Spreadsheet and open your macro-enabled workbook (.xlsm).
  2. 2. Access Developer Tools: Navigate to the 'Developer' tab on the main ribbon interface.
  3. 3. Open Macros List: Click the 'Macros' button to open a dialog displaying all available VBA procedures associated with the current file.
  4. 4. Run Macro Directly: Select the required macro from the list and click 'Run'. This executes the code safely within the current workbook, bypassing any broken ribbon links.
Native support for VBA and .xlsm filesFully compatible with Microsoft Excel macro formatsIntuitive Developer tools built directly into the interfaceNo complex XML editing required for standard macro execution
microsoft office alternative - wps office

Frequently Asked Questions

Why do custom ribbon buttons point to the old Excel file?

When you assign a macro to a custom ribbon button, the software often binds it to the absolute file path of that specific workbook. When the workbook is copied, the button retains that exact path and searches for the original file when clicked.

Can I prevent macro buttons from linking to the old workbook in the future?

Yes. Instead of attaching macros to custom ribbon buttons, you can trigger them using Form Controls or ActiveX command buttons placed directly on the spreadsheet itself. These controls travel safely with the workbook without retaining absolute external path links.

Does renaming the workbook cause the same macro link issue?

Yes. If the ribbon customization explicitly referenced the old filename, simply renaming the workbook will break the button. It will attempt to search for the old name, either throwing an error or opening an older backup file if it exists in the same folder.

How do I easily remove broken custom ribbon groups?

Go to File > Options > Customize Ribbon. Find your custom group in the right-hand panel, right-click it, and select 'Remove'. You can then create a fresh group and assign the local macros to it.