How To Determine If An Excel Is Being Used By Other User ?

How to check the Excel files status, if the Excel file in the network folder is opened by other users?

To determine whether Excel is being used, Filestream can be used. Use the Assign activity to assign a value to a variable named outputFileStream. For example, if the file is being used, an error will be reported. Judge whether the file is being used based on this.

After the outputFileStream is opened, use the invoke method to close it, as shown in the following figure.



The type of outputFilestream is System.IO.Filestream, and the right value of assign activity is:

  • System.IO.File.Open(outputLogFilepath, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite)

The outputLogFilepath can be set as the file path through variables.