Excel Application Scope - Not able to open up the Excel file from desktop from a defined variable

Hi, I am quite new to UIPath. I have encountered below exception error while running my main.xaml file.

  1. It does not allow me to open the excel file saved from my desktop via a defined variable, such as, I defined a variable called in_RefRpt, its Default value points to my desktop. When I run this xaml file, it pops up an exception error.

  2. This issue will be gone if I directly define the WorkbookPath from Excel Application Scope but I don;t know why.

Please kindly share with me if you ave any thoughts.

Thanks!

Attached my xaml file here.

Below is the error code:

18.4.5+Branch.support/v2018.4.Sha.2a53a262e2c1098055c3ecbdabe73d45e0a6dc29

Source: Excel Application Scope

Message: Exception from HRESULT: 0x800A03EC

Exception Type: UiPath.Excel.ExcelException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
UiPath.Excel.ExcelException: Exception from HRESULT: 0x800A03EC ----> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC
at Microsoft.Office.Interop.Excel._Workbook.SaveAs(Object Filename, Object FileFormat, Object Password, Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup, XlSaveAsAccessMode AccessMode, Object ConflictResolution, Object AddToMru, Object TextCodepage, Object TextVisualLayout, Object Local)
at UiPath.Excel.WorkbookApplication.CreateNewWorkbookIfNeeded(String workbookPath, Boolean createNew, Workbooks workbooks)
at UiPath.Excel.WorkbookApplication.Initialize(WorkbookArguments args)
β€” End of inner ExceptionDetail stack trace β€”
at UiPath.Excel.WorkbookApplication.Initialize(WorkbookArguments args)
at UiPath.Excel.WorkbookApplication.Initialize(Application excelApp, WorkbookArguments args)
at UiPath.Excel.Activities.ExcelApplicationScope.Execute(NativeActivityContext context)
at System.Activities.NativeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

@Victor_Victory

Thank you for your inquiry and welcome to the forum

take a look at this picture:

You are missing a part of the path, you just had \Desktop\SP_TestFile2.xlsx" whis is incomplete

as a bonus I am adding the environmnet.username, which will retrieve the current user, this is helpful when you deploy your solutions in other pcs.

"C:\Users" & Environment.UserName &"\Desktop\SP_TestFile2.xlsx"


Don’t forget to like us :heartpulse:
Happy Automation!

3 Likes

Thank you!!!

1 Like

Hi @Victor_Victory it is a pleasure :slight_smile:

come back soon

Happy Automation!

1 Like

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