Excel Applicaiton Scope - Microsoft Excel cannot access file

I made a project using the robotic enterprise framework that creates an excel file somename.xlsx using Excel Application Scope activity. When I run the robot on one machine, it works fine. When the robot is run on another machine, a fatal error occurs while running the job:

System exception at initialization: Microsoft Excel cannot access file ‘C:\Users\username\Documents\Foldername\57E83320’. Possible causes: filename or path does not exist - File is used by another program - the project folder you are trying to save has the same name as one that is open right now.

Usually Excel Applicaiton Scope creates a file named somename.xlsx at the path ‘C:\Users\username\Documents\Foldername’, but in this case no file is created before the robot stops the execution early.

In stead of ending with 57E83320, the path should end with somename.xlsx, maybe that is why the robot cannot access the file. I do not know where 57E83320 comes from, but I think the error might come from this. Any suggestions what to do?

I use Studio 2020.4.1 Community Licence and Excel Activities version v2.7.2

hi @kaka-fb,

Before Directly passing the path to the excel application, your flow can be like.

  1. Take 2 Variables - StrVariablePath and StrExcelName.

  2. We Take path exist Activity and Pass the Folder path - If True - Awesome , If false we generate an exception saying Path not avaialbe.

  3. If step 2 - True : then we check File Exists : path\strExcelName.xlsx

  4. If excel exist - OKay - IF not - create the excel

4.Once created - Read the Excel.


Mukesh

Hi Mukesh, the program has a Path Exists activity that takes the file path of the excel file as input followed by an if statement, that creates an excel file, if the path does not exist.

Hi @kaka-fb,

This looks Good ,

One thing - Before the Excel application scope - Can you print the Path and see if we are getting teh Correct path… As stated we are getting the 57E83320 extra here …

An approach can be removing the extra bot from the path using string manipulation and then passing it to the Excel scope


Mukesh

I found the solution. A digit in the folder name, that was included in the file path, had been changed by another person on the machine where the program was giving the error.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.