Validate an excel file if it is open

Dear Friends

Very grateful for your answers, to resolve the following:

How can I validate if an excel file is open or not?

Dim excel as new ExcelApplication                   
Dim book as ExcelWorkbook   
Dim ruta As String = Uppercase(Self.txtRuta.text)
book =  

Your answers will be greatly appreciated.


Raul Juarez Pulache

Are you writing an application for WINDOWS?

This might help…

Alternatively, you might like Eugene Dakin’s book
“Program Excel 2016 with Xojo in Windows”

you mean this part?

i would test nil or use try catch

Hi Markus Rauch

If the excel file is not open run the following
book = (path)
Otherwise do not open the file

Validity is needed because the user can open the file directly from the Excel and when the application is run it is already open.


did you try if the opened excel is listet in workbooks? (same pc same user account)