Hello All,
I'm trying to use Launch Excel to open an excel file using a variable for File Name.
Variable "%xlsFile%" = "fileone.xls".
So document path is populated as : "C:\Users\me\OneDrive\RPA\TCR\In\Temp attachments\%xlsFile%
Even though the path and file name is correct, I am getting an error as if the path and file name was not correct.
Error is:
Robin.Core.ActionException: Failed to open Excel document '(File related error.)' C:\Users\me\OneDrive\RPA\TCR\In\Temp attachments\fileone.xls
Here's my version of PAD
Anyone know what may be causing this?
Thanks!
Long error below:
Robin.Core.ActionException: Failed to open Excel document '(File related error.)' C:\Users\me\OneDrive\RPA\TCR\In\Temp attachments\fileone.xls
. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Sorry, we couldn't find C:\Users\me\OneDrive\RPA\TCR\In\Temp attachments\fileone.xls
. Is it possible it was moved, renamed or deleted?
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Robin.Modules.Excel.Actions.ExcelActions.InvokeMethod(Object o, String methodName, Object[] methodArgs)
at Robin.Modules.Excel.Actions.ExcelActions.LaunchExcel(Variant documentPath, Variant varPassword, Variant& excelInstance, Int32 launchMode, Boolean visible, Boolean loadAddInsAndMacros, Boolean needsAuthentication, Boolean readOnly)
--- End of inner exception stack trace ---
at Robin.Modules.Excel.Actions.LaunchExcel.Execute(ActionContext context)
at Robin.Runtime.Engine.ActionRunner.RunAction(String action, Dictionary`2 inputArguments, Dictionary`2 outputArguments, IActionStatement statement)
Solved! Go to Solution.
So I didn't fix the issue of why the path wouldn't work in Launch Excel using the variable for file name I was using. Even thought it was writing correctly. I did find out a work around.
I was using a loop to look through downloaded attachments from Retrieve email messages from Outlook. l was downloading for excel files only but people send signatures etc that are jpg, png. So I had an xtra loop and if condition to only find xls files. Then write the full path of the xls file to a variable.
Outside of that xls loop was I was trying to write the launch excel action since I got the value I wanted in the previous loop. PAD didn't like that.
Long story short, I moved the Launch Excel action into the most inner loop that is filtering for excel files and used that variable from the if condition and that it worked!
Another point, Launch Excel took the full variable for path and file name once it was placed within the this loop.
Any ideas on what might be causing this?
I do see an odd paragraph return after the file name fileone.xls in the error.
If I use set clipboard text to copy and paste the full value, Notepad++ sees the paragraph return but MS Word doesn't.
"Robin.Core.ActionException: Failed to open Excel document '(File related error.)' C:\Users\me\OneDrive\RPA\TCR\In\Temp attachments\fileone.xls
. --->"
Any reason why that is happening or how to remove it?
This might be what is causing the issue.
Much appreciated!
Hello @r96359 ,,
Can you please confirm that the problem is specific to the file?
The error "Failed to open Excel document '(File related error.)" is caused when the file has a corrupt add-in in the program or when your excel program may be conflicting in some way with another program. A file in the Excel startup folder may have some problems.
Can you repair you Office application and try again?
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Try to change the input:
C:\Users\me\OneDrive\RPA\TCR\In\Temp attachments\\%xlsFile% (two backslashes at the end)
@CFernandes Thanks for the reply! Xls isn't corrupt. Opens fine outside of PAD using the same URL.
@Henrik_M Thanks for the reply! I tried that and I got the same error.
Robin.Core.ActionException: Failed to open Excel document '(File related error.)' C:\Users\me\OneDrive\RPA\TCR\In\Temp attachments\\fileone.xls
So I didn't fix the issue of why the path wouldn't work in Launch Excel using the variable for file name I was using. Even thought it was writing correctly. I did find out a work around.
I was using a loop to look through downloaded attachments from Retrieve email messages from Outlook. l was downloading for excel files only but people send signatures etc that are jpg, png. So I had an xtra loop and if condition to only find xls files. Then write the full path of the xls file to a variable.
Outside of that xls loop was I was trying to write the launch excel action since I got the value I wanted in the previous loop. PAD didn't like that.
Long story short, I moved the Launch Excel action into the most inner loop that is filtering for excel files and used that variable from the if condition and that it worked!
Another point, Launch Excel took the full variable for path and file name once it was placed within the this loop.
I am facing the same issue where launching the excel using variable get fails
I as well am facing the same issue.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Read the latest about new experiences and capabilities in the Power Automate product blog.
If you are a small business ISV/Reseller, share your thoughts with our research team.
User | Count |
---|---|
22 | |
7 | |
4 | |
3 | |
2 |