Fix a VBA Project That Remains Visible After Closing an Excel Workbook
Question details
Find out why a macro-enabled workbook's VBA project remains visible after the workbook is closed.

- Product
- Microsoft Excel for Microsoft 365
- Device & OS
- not provided
- Scenario
- A user closes a macro-enabled workbook and checks Project Explorer in the Visual Basic Editor.
- Observed behavior
- The workbook's VBA project remains visible in Project Explorer after the workbook is closed.
Note the project name and the workbook's expected file path. Check whether the project belongs to a regular workbook, an add-in, or the Personal Macro Workbook before closing or resetting anything.
Check the VBA project's workbook path and open workbooks
Use the Immediate window and Excel's window controls to identify the file associated with the visible project.
In Excel, open Developer > Visual Basic. In Project Explorer, open a standard module under the project that remains visible.
Open View > Immediate Window, type ?ThisWorkbook.FullName, and press Enter. Record the returned path or any error; make sure the module from the relevant project is active.
Return to Excel and select View > Unhide. If the workbook appears in the list, select it and click OK, then close it using File > Close.
Switch through your open Excel windows and check whether another window has the same file or another copy open. Close the relevant workbook in that window if appropriate.
If Excel permits it, rename or move the closed file in your file manager, then run ?ThisWorkbook.FullName again in the project's Immediate window. Compare the result or error with the original path, and restore the file name or location afterward.

Reset running VBA code and close user forms
Use this when paused code, open forms, or project-level references may be involved.
Compare add-ins, macro settings, and Office installations
Use this when the behavior differs between computers or the visible project belongs to an add-in.
Work with spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for everyday spreadsheet work. Open compatible Excel files and migrate routine editing tasks with minimal adjustment. It does not fix a VBA project remaining visible in Microsoft's Visual Basic Editor.

Frequently Asked Questions
How can I tell which file a visible VBA project belongs to?
Open a module in that project, select View > Immediate Window, and run ?ThisWorkbook.FullName. The result gives the associated workbook path, or an error if the expression cannot be evaluated.
Could the workbook still be open but hidden?
Yes. In Excel, select View > Unhide and check the list. If the workbook is listed, unhide it and use File > Close.
What does Reset do in the Visual Basic Editor?
Run > Reset stops running VBA code and clears project variables. You may need to restart macros or forms afterward.
Why does a project stay visible if it belongs to an add-in?
An enabled Excel add-in can remain loaded even when its workbook window is not visible. Check File > Options > Add-ins and review the relevant Manage list before changing its status.




