Validate an excel file if it is open

Dear Friends
Xojo

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 = Excel.workbooks.open(ruta)  

Your answers will be greatly appreciated.

Cordially,

Raul Juarez Pulache

Are you writing an application for WINDOWS?

This might help…
https://documentation.xojo.com/api/windows/excelapplication.html

Alternatively, you might like Eugene Dakin’s book
http://www.xdevlibrary.com
“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 = Excel.workbooks.open (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.

Raul

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