So I have a file path with folders and files inside. I want to search this path for any files (xlsm) within this path, ending in a certain text eg: BF_123456 - and then subsequently open this file.
The issue is that the prefix to this variable may be different so not so simple.
Get all the files inside that folder and store in an array of type string
Use that string array and loop through all the folders and get files inside that folder of type xlsm and store them in another array of type string
Use another for each loop inside and check if the file contains that particular string and then close the loop if the particular file is acquired using break condition
Fine
—while getting the file path array from that folder use this expression arr_filepath = Directory.GetFiles(“yourfolderpath”,”*.xlsm”)
This will get only the xlsm file from that folder
—now use a FOR EACH activity and pass the vaive variable as input and change the type argument as string in the property panel
—inside the loop use IF condition like this item.ToString.Contains(“BF_123456”)
If true it will go to THEN part where we can use EXCEL APPLICATION SCOPE and pass the file path as item.ToString
Appreciate the speedy responses! Unfortunately I’m still learning and finding it difficult to follow your instructions. What activity to get all files? and then I’m not sure how to convert to the array table. And the rest…
[quote=“Palaniyappan, post:3, topic:172171”]
arr_filepath = Directory.GetFiles(“yourfolderpath”,”*.xlsm”)
[/quote
We can use ASSIGN activity where arr_filepath is a variable of type array of string, defined in the variable panel
This will get only the xlsm file from that folder
Then this
[quote=“Palaniyappan, post:3, topic:172171”]
—now use a FOR EACH activity and pass the vaive variable as input and change the type argument as string in the property panel
[/quote]]
Use FOR EACH activity and pass the variable arr_filepath as input
Thanks man - is that just added to my example .xaml above? Getting some errors when assigning that… also I think the $ in my file path is ineligible - could I use an ‘*’ in place of this?