Opening the Excel file in the script fails with error "Microsoft Excel cannot access the file"

Symptoms

The project has a script that opens the Excel file using Microsoft.Office.Interop.Excel and System.Runtime.InteropServices.

The script fails with Microsoft Excel cannot access the file error.

The following points were checked:

  • The Processing Station computers have Microsoft Office installed and activated.
  • The file is not in use (is not opened by any other program or Excel).
  • The file path is correct.
  • The user that runs Processing Station has Administrator rights and has full access to the Excel file.
  • The Excel file is not corrupted.

Cause

The user that runs the Microsoft Excel Component Service may have insufficient rights.

Resolution

Explicitly specify the user with Administrator rights and with full access to the Excel file in the Microsoft Excel Component Service:

  1. Open Component Services.
  2. Navigate to DCOM Config > Microsoft Excel Application.
  3. Open its properties and switch to the Identity tab.
  4. Specify the new user.
    mceclip0.png

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.