Fix PowerPoint VBA Error: Linked Excel File Unavailable on Second Run
Question details
The user encounters an issue where a PowerPoint VBA macro successfully updates Excel-linked shapes on its first execution but fails on subsequent runs, incorrectly reporting that the linked Excel file is unavailable.

- Product
- PowerPoint, Excel, VBA
- Device & OS
- not provided
- Scenario
- Running a custom VBA macro in PowerPoint to automatically update presentation shapes that are linked to an external Excel workbook.
- Observed behavior
- The macro completes successfully on the first attempt. On the second attempt, it throws an error stating the linked file is unavailable, despite the Excel workbook remaining in its original file path.
Ensure that the linked Excel workbook is not currently locked by another background process and that you have saved a backup copy of both your PowerPoint presentation and the Excel file before modifying your VBA code.
Properly Release Excel Objects in the VBA Code
Ensure your VBA macro explicitly closes the Excel workbook and releases the application object memory after updating shapes to prevent background lockouts.
When a PowerPoint VBA macro connects to an external Excel file, it creates a hidden background instance of Excel. If the code finishes executing without properly closing this instance, the file remains locked by the operating system. On the second macro run, PowerPoint is denied access, resulting in the 'file unavailable' error.
In PowerPoint, press 'ALT + F11' on your keyboard to open the Visual Basic for Applications (VBA) editor.
In the Project Explorer panel, double-click the module containing the macro that updates your linked Excel shapes.
Scroll to the end of your procedure and ensure you have a line that explicitly closes the workbook, such as: 'xlWorkbook.Close SaveChanges:=False' (change to True if you made modifications you want to keep).
Add a command to terminate the background Excel process: 'xlApp.Quit'.
Explicitly clear object memory by adding 'Set xlWorkbook = Nothing' and 'Set xlApp = Nothing' right before the 'End Sub' statement.

Consult Developer Communities for Custom VBA Support
Because custom VBA troubleshooting falls outside the scope of general Microsoft Office support, leveraging specialized developer forums is the best path for complex link-management logic errors.
Try WPS Office for Seamless Macro Execution
If you are frequently dealing with complicated link-management issues or heavy background processes in Microsoft Office, consider switching to WPS Office. It provides a lightweight, highly compatible alternative that natively supports essential VBA macros and handles documents, spreadsheets, and presentations efficiently in a single tabbed workspace.
- 1. Download and Install: Visit the official WPS Office website to download and install the software.
- 2. Open Your Files: Launch WPS Office and open your .pptm and .xlsm files directly in the unified workspace.
- 3. Run Macros: Navigate to the Developer tab to enable, edit, and run your VBA macros safely.

Frequently Asked Questions
Why does my PowerPoint VBA macro only work the first time?
This commonly occurs because object variables—such as the background Excel Application or Workbook objects—are not explicitly released or closed in your code. The hidden background process remains open and locks the file, preventing the second run from accessing it.
How can I force PowerPoint to update Excel links manually?
You can update linked files manually without VBA by going to File > Info > Edit Links to Files. Select the connected Excel workbook from the list and click 'Update Now'.
Does WPS Office support VBA macros?
Yes, WPS Office supports VBA macros. Users can enable the Developer tab to record, write, and execute VBA code in WPS Spreadsheets, Presentation, and Writer, making it an excellent alternative for automated tasks.
How do I debug the 'linked file unavailable' error in VBA?
Open the VBA editor and step through your code line-by-line using the F8 key. This allows you to identify exactly which line throws the error. Ensure you implement proper error handling and release all objects by setting them to 'Nothing' at the end of the script.




