in reply to Finding if a file is open

In Windows, files are locked exclusively by default. If Excel does this, you could find out by simply trying to open the file. It'll fail if it's already open.

Replies are listed 'Best First'.
Re^2: Finding if a file is open
by pc88mxer (Vicar) on May 15, 2008 at 15:24 UTC
    If Excel does this, you could find out by simply trying to open the file. It'll fail if it's already open.
    Actually, this is not true. Under cygwin perl I was able to open (using open) for writing a file that was currently opened by Excel. Trying to open that same file using WordPad, however, resulted in the familiar "The document ... is in use by another application ..." message.
      I said "If Excel does this". All you've shown is that Excel could be using some form of advisory locking instead that WordPad obeys.