Fix Excel Macros That Open the Original Workbook After Copying in WPS Office
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.

- 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.
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.
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.
Open the copied .xlsm workbook in WPS Spreadsheets and make sure it is the active workbook.
Click the Customize Quick Access Toolbar drop-down arrow at the top of the window, then choose More Commands.
In the Choose commands from list, select Macros, choose the macro stored in the copied workbook, click Add, and then click OK.
Use the new Quick Access Toolbar button and confirm that it runs the macro in the copied workbook instead of opening the original file.

Create a Custom Ribbon Inside the XLSM File Using Ribbon XML
Use this advanced method when you need a dedicated custom Ribbon tab stored inside the copied workbook so the interface and macros stay together.
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. Open the copied XLSM workbook: Launch WPS Office, open WPS Spreadsheets, and load the copied macro-enabled workbook.
- 2. Open Quick Access Toolbar customization: Click the Customize Quick Access Toolbar drop-down arrow and select More Commands.
- 3. Add the workbook macro: Choose Macros from the command list, select the macro stored in the copied workbook, click Add, and confirm.
- 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.

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.




