VBA & Macro Problems

Fix an Excel Macro After Renaming or Copying a Workbook

Camila MilosovichCamila Milosovich Nov 18, 2026 870 views

Question details

Restore a macro that behaves differently after its Excel workbook is renamed or copied.

Fix an Excel Macro After Renaming or Copying a Workbook
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user renames or duplicates a macro-enabled workbook and wants to run its VBA macro.
Observed behavior
The macro stops working or behaves differently, even though the workbook folder is listed as a trusted location.
Before you start

Confirm that the renamed or copied file has a macro-enabled extension such as .xlsm, and identify the macro that no longer works. Check whether Excel displays a security warning when you open the file.

Solution 1Recommended

Clear the workbook author property and retest the macro

Try clearing the Author field as a reported workaround, then reopen the workbook to see whether it resolves the issue.

1
Open advanced properties

In Excel, open the affected workbook and select File > Info > Properties > Advanced Properties.

2
Clear the author

On the Summary tab, clear the Author field and select OK.

3
Reopen and test

Save and close the workbook, reopen it, and run the macro from Developer > Macros. Check whether it now behaves as expected.

Clear the workbook author property and retest the macro
If the macro still fails: Clearing the author property is a workaround, not a guaranteed fix. Check the file format, security settings, and workbook references next.
Free Microsoft Office alternative

Work with Excel spreadsheets in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Office format compatibility for an easier move between apps. It does not fix Excel's macro security or workbook settings, and VBA support can vary by platform and version.

Open and edit spreadsheet data in a familiar interfaceCompatible with common Microsoft Excel formats, including .xlsxWork with workbook data without relying on the affected Excel macroUse a free, lightweight office suite for everyday documents
microsoft office alternative - wps office

Frequently Asked Questions

Why would a macro stop working after I rename a workbook?

The VBA code may refer to the original filename or path. Open Developer > Visual Basic and look for hard-coded references to the old name.

Does a trusted folder guarantee that my macro will run?

No. The workbook must still contain the macro, and its code and references must be valid. File-origin restrictions or organizational policies can also affect macro behavior.

What is the difference between ThisWorkbook and ActiveWorkbook in VBA?

ThisWorkbook refers to the workbook containing the running code. ActiveWorkbook refers to the workbook currently active in Excel, which may be a different file.

Can I recover a macro by saving an .xlsx file as .xlsm?

Changing the file type back to .xlsm does not restore VBA code that was removed. Open a copy that still contains the macro, then use File > Save As to save it in a macro-enabled format.