VBA & Macro Problems

Fix Excel Macros That Open the Original Workbook After Copying in WPS Office

Rana GarciaRana Garcia Nov 13, 2026 869 views

Question details

A copied XLSM workbook may appear independent, but its custom Ribbon controls can still run macros from the original workbook when Ribbon customization is stored at the application level instead of inside the workbook.

Fix Excel Macros That Open the Original Workbook After Copying
Product
WPS Spreadsheets / Microsoft Excel
Device & OS
not provided
Scenario
The user copies an XLSM workbook and expects the custom Ribbon buttons in the copy to run macros stored in the copied file.
Observed behavior
Custom Ribbon controls in the copied workbook still open or run macros from the original workbook because they reference the global Excel or application-level Ribbon customization.
Before you start

Identify whether the Ribbon buttons were created through the global Customize Ribbon dialog or through workbook-level Ribbon XML. Open the copied XLSM file and note which workbook is active when a custom button runs.

Solution 1Recommended

Add the Workbook Macro to the Quick Access Toolbar for the Copied File

Use this method when you need a simple, workbook-specific button that travels with the copied XLSM file and runs macros in the active copied workbook.

Excel's global Customize Ribbon settings are not reliable for workbook-specific controls. Placing the macro on the Quick Access Toolbar for the copied workbook keeps the command tied to that file instead of the original.

1
Open the copied workbook

Open the copied .xlsm workbook in WPS Spreadsheets and make sure it is the active workbook.

2
Open Quick Access Toolbar settings

Click the Customize Quick Access Toolbar drop-down arrow at the top of the window, then choose More Commands.

3
Add the workbook macro

In the Choose commands from list, select Macros, choose the macro stored in the copied workbook, click Add, and then click OK.

4
Test the button

Use the new Quick Access Toolbar button and confirm that it runs the macro in the copied workbook instead of opening the original file.

Add the Workbook Macro to the Quick Access Toolbar for the Copied File
Copied workbook now runs its own macro: Use the new Quick Access Toolbar button while the copied workbook is active. The button targets macros stored in that workbook, not the original file.
WPS Spreadsheets macro fix

Make Copied Excel Macros Run in the Copied Workbook with WPS Office

In WPS Spreadsheets, attach macros to the workbook-level Quick Access Toolbar or embed a custom Ribbon inside the XLSM file. This keeps the copied workbook running its own macros and prevents it from opening the original file.

  1. 1. Open the copied XLSM workbook: Launch WPS Office, open WPS Spreadsheets, and load the copied macro-enabled workbook.
  2. 2. Open Quick Access Toolbar customization: Click the Customize Quick Access Toolbar drop-down arrow and select More Commands.
  3. 3. Add the workbook macro: Choose Macros from the command list, select the macro stored in the copied workbook, click Add, and confirm.
  4. 4. Test the button in the copy: Run the new toolbar button and confirm it executes the macro in the active copied workbook instead of opening the original file.
Workbook-level Quick Access Toolbar buttons keep macros connected to the copied fileCustom Ribbon XML lets the copied XLSM carry its own interfaceFull compatibility with Excel .xlsm macro-enabled workbooksFamiliar Excel-like ribbon and VBA macro editing environmentFree, lightweight Office suite that avoids global customization surprises
microsoft office alternative - wps office

Frequently Asked Questions

Why does my copied Excel macro still open the original workbook?

The custom button was likely created in Excel's global Customize Ribbon dialog, which stores the control at the application level. The copied workbook reuses that command and therefore points back to the original file.

Can I make a macro button travel with a copied XLSM workbook?

Yes. Add the macro to the Quick Access Toolbar for that specific workbook, or create a custom Ribbon inside the XLSM file using Ribbon XML. Make sure the callback code uses ActiveWorkbook or ThisWorkbook.

Where do I add a workbook-specific Quick Access Toolbar macro in WPS Office?

Open the copied workbook, click the Customize Quick Access Toolbar arrow, choose More Commands, select Macros from the command list, and add the macro stored in that workbook.

Do I need to edit the VBA callback code after copying the workbook?

If the callback hard-codes the original workbook name, yes. Replace that reference with ActiveWorkbook or ThisWorkbook so the macro runs on the currently opened copy.

Does WPS Office support Excel XLSM macros and custom Ribbon XML?

WPS Spreadsheets supports Excel macro-enabled workbooks and common VBA and macro scenarios. Advanced custom Ribbon XML features should be tested in your WPS Office version because support can vary.