DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

check if excel file open

Solved!
Go to solution

Hallo,

 

how can i check if a excel file is open or not open. I need a code for the diadem script.

 

thanks

0 Kudos
Message 1 of 3
(3,428 Views)
Solution
Accepted by topic author Joediadem

You can use code like this to make sure that a file is accessible exclusively.

 

Option Explicit

dim xlsxFile : xlsxFile = "C:\temp\out_EXPORT.xlsx"
MsgBox FileAccessible(xlsxFile)

function FileAccessible(byref filePath)
  FileAccessible = FALSE
  dim fh : fh = TextFileOpen(filePath, eTextFileAttributeExclusive OR eTextFileAttributeRead OR eTextFileAttributeANSI)
  if -1 <> fh then
    call TextFileClose(fh)
    FileAccessible = TRUE
  end if
end function
0 Kudos
Message 2 of 3
(3,419 Views)

perfect, thank you

0 Kudos
Message 3 of 3
(3,396 Views)