There are 2 excel file located in the local drive, and there are more than 1 Workflow process will open and read the excel files at the same times, for data lookup, using VBScript.
I noticed that, sometimes there are no value being lookup.
Will it due to more than 1 workflow process is accessing the same Excel File at the same time?
If you use the Excel.Application object, it is likely that you will run into issues because that object is not thread-safe.
If you use FileSystemObject.OpenTextFile to open and read the file, then you must simply make sure to specify the ForReading value for the ioMode function parameter when opening the file to ensure that it can be shared across processes.
I see one potential issue with your code: you use adOpenStatic as your cursor type, which means new data may not be immediately available to the cursor. While that is unlikely to cause you any problem, it’s something to consider.
Since all you’re doing with your cursor is navigate forward to find specific records, I’d recommend using adOpenForwardOnly (i.e. 0) as the cursor type, which will improve performance and eliminate that remote possibility I mentioned above.
Note also that since you don’t use the FSO object, you should remove all references to it.
Finally, your loop goes through all records returned by your query. For each record, you set local process variables to the values found in the fields. That means it’s always the values found in the last record that actually get stored in the variables. If that’s really what you want, then it’s ok. But if you only want the first value and then exit the loop, you should use the exit do statement once you have found the first value, which will help performance…