Issue on opening the excel application scope using Argument Varaible

Hi,

I have a text file which has multiple path details which is comma separated
for eg:Location1,Location2 like this .

I got the location details using Array and stored into argument variable.

But im facing the issue when using the excel application scope and used that argument variable. Im getting below exception

Source : Excel Application Scope

Message: Illegal Characters in path

Exception Type: System.ArgumentException

Note: If i hardcoded means in Excel Application scope it is working fine. Also i used the message box to check the variable value and it is coming correctly.

Not sure when i used the argument variable in excel application scope it causing the issue. please suggest

Hi @asatheeshk21

Can you show your workflow ?

sorry, Unable to share due to security reason. When i used only one location in txt file , I dont see any issue in excel application scope, but when i tried multiple locations in txt file getting the above error but still i used the message box to check for multiple locations it is working fine.please suggest

@asatheeshk21

Did you check your argument after passing it to an other worklow, like on a write line message, to see if it has any value inside, also check the whole path you are trying with the argument… like “c:\user” + argument

See what it gives you…

Yes I have checked that already i could see the value from other sequence the whole path im able to see in message box

How do you try to get the data from your argument to your excel scope ?

You should do something like this :

if you have white spaces in the paths, then use the variables like this:
""" + pathVariable + """

I tried with this as well.Still getting the same error

image

There is no space in the path

@asatheeshk21 I guess even some extra characters are appended to it, try this :
item.ToString.Trim.Replace("""","") If the error still persists can i See the Value inside a Message Box or in WriteLine

1 Like

Hello,
using Assign Activity as Below :
regexSearch = New String(Path.GetInvalidFileNameChars()) + New String(Path.GetInvalidPathChars())
regexSearch as String
Add another assign Activity :
r = New Regex(String.Format("[{0}]", Regex.Escape(regexSearch)))
r As Regex
use another assign activity :
item = r.Replace(item.tostring(), “”)

Thanks.

Thanks this got worked.

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