Unable to open all files from Directory using For Each

While iterate through files in a directory I am able to retrieve the files names, however I am not able to open those files. Getting an error message

“Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.”

Please advise.

Hi,

In many case, double quote except 0x22 character causes this matter. So, can you retype/replace all the double quote with 0x22 character (") in the activity?

Regards,

1 Like

Hello Yoichi,

Here is project outline. Sorry not able to share the project file since website is not allowing me.

  1. Add an Assign Activity. Created an Array of String StrFilePath = Directory.GetFiles("Open File From Directory\TEXT FILES")

  2. Add For Each Activity to iterate on String Array Variable. Output = currentTextFile variable which contains single file path while looping.

  3. Add Use Browser/Application inside For Each. Indicate the Notepad application.

Application path = “C:\Windows\System32\notepad.exe”
Application Argument = currentTextFile
Selectors have been fine tuned.

So, I am providing each file path using currentTextFile variable instead of hardcoding. While I am providing any single file’s path (hardcoded) it is working fine in that scenario.

Hi @Tech_Syntax,

Instead of ‘Use Browser’ try Start Process activity to open the files in notepad

Hi,

Can you identify which activity throws this error?

For now, can you try to retype/replace all the double quote with " in the above line?

Regards,

Hi @Tech_Syntax

Pls debug the code step by step and find out in which activity raising the error.
or try save and reopen your project to force compilation. ensure all variables are correctly initialized and expressions are valid to avoid the compilation error.

I am getting error in Use Application/ Browser Activity. I removed double quotes ("), but that is throwing error.

Thanks @mrv.raj ! It works!

@Tech_Syntax Though this has been resolved using another method, please refer to the correct syntax using your first method.

$"'{curFilePath}'"

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