logo
search
VBA & Macro Problems

How to Fix a Microsoft Project Excel Export Macro That Runs Only Once

Elise WilliamsElise Williams Oct 15, 2026 869 views

Question details

A VBA macro designed to export Task Usage View data from Microsoft Project to Excel works successfully the first time but fails on subsequent executions.

How to Fix a Microsoft Project Excel Export Macro That Runs Only Once
Product
Microsoft Project / Microsoft Excel
Device & OS
not provided
Scenario
Exporting Task Usage View data from Microsoft Project to an Excel workbook using a VBA macro.
Observed behavior
The macro executes correctly on its first run but becomes unreliable and fails unpredictably during repeated executions, often due to direct copy-pasting from the Project view and residual data conflicts.
Before you start

Ensure you have saved backups of both your Microsoft Project file and the target Excel workbook before modifying your VBA code.

Solution 1Recommended

Use the TimescaleData Method Instead of Copy-Paste

Replace direct copy-pasting from the Project view with the more reliable and efficient TimescaleData method in your macro.

Macros that perform large amounts of copying and pasting directly from the Project view are notoriously unreliable for repeated use. Transitioning your code to utilize the TimescaleData method ensures data is extracted programmatically, minimizing UI-based errors and clipboard conflicts.

1
Open the VBA Editor

In Microsoft Project, press ALT + F11 to open the Visual Basic for Applications (VBA) editor and locate your export macro module.

2
Replace Copy-Paste Operations

Locate the sections of your code that copy directly from the Task Usage View and remove the clipboard-dependent commands.

3
Extract Data Programmatically

Implement the TimescaleData method to directly extract time-phased data from the project objects into variables, which can then be written directly to the target Excel cells.

Use the TimescaleData Method Instead of Copy-Paste
Improved Efficiency: Using the TimescaleData method not only improves reliability but also significantly speeds up the execution time of your macro.
Free Microsoft Office alternative

View and Analyze Exported Project Data with WPS Office

While Microsoft Project macros require specific MS Office integrations, you can seamlessly open, view, and analyze your exported Excel project data using WPS Office. It provides a lightweight, highly compatible alternative for all your spreadsheet needs without the heavy subscription fees.

  1. 1. Download WPS Office: Visit the official WPS website to download and install the free WPS Office suite on your computer.
  2. 2. Open WPS Spreadsheet: Launch the WPS Spreadsheet application to handle your newly exported Excel files.
  3. 3. Analyze Your Project Data: Open your exported .xlsx or .xlsm file to view, format, and analyze your time-phased project data without requiring Microsoft Excel.
Fully compatible with Microsoft Excel formats (.xlsx, .xls, .xlsm).Lightweight installation and incredibly fast loading times.Familiar user interface with no steep learning curve.Free alternative for viewing, formatting, and analyzing exported project data.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my VBA macro fail on the second run?

Macros often fail on subsequent runs if object references to Excel are not properly released in the code, or if residual data from the first run disrupts the target pasting range.

What is the TimescaleData method in MS Project VBA?

The TimescaleData method is a programmatic way to extract time-phased information directly from tasks, resources, or assignments, avoiding the unreliability and slowness of UI copy-pasting.

How can I safely clear an Excel sheet using VBA?

You can use the Worksheet.Cells.Clear method targeting your specific worksheet inside the macro to erase all existing content and formatting before writing new data.

Can WPS Office open Excel files with macros?

Yes, WPS Office is highly compatible with Microsoft Excel formats and supports opening and viewing .xlsm files. Full VBA macro execution and editing support is available in professional versions of WPS Office.