Win32ole, how to detect docfile is already opened?

Hi,

running ruby 1.8.4 on Win2000, some word scripting
with Office 2003

require 'win32ole'

word = WIN32OLE.new('Word.Application')
doc = word.Documents.Open('c:/foobar.doc')

Question =

i want to do a text search and replace
and i need to detect whether the docfile
is already opened by someone else, when
word comes up with a dialog (3 radiobuttons)
similar to that =

Title = bla.doc already in use

o> Open write protected readoonly
o> Open a copy and merge afterwards
o> Tell me when bla.doc is open

I want to check whether the docfile is
already opened, and if yes, i start
to loop until the docfile is free, then
do the replace ...

How do i realize whether the docfile is already opened ??

I searched already in irb via

puts docs.ole_methods.sort
and
puts docs.ole_methods.sort

but didn't come up with a solution

Any hints ?

Regards, Gilbert

running ruby 1.8.4 on Win2000, some word scripting
with Office 2003

require 'win32ole'

word = WIN32OLE.new('Word.Application')
doc = word.Documents.Open('c:/foobar.doc')

Question =

i want to do a text search and replace
and i need to detect whether the docfile
is already opened by someone else, when
word comes up with a dialog (3 radiobuttons)
similar to that =

Title = bla.doc already in use
>o> Open write protected readoonly
>o> Open a copy and merge afterwards
>o> Tell me when bla.doc is open

I want to check whether the docfile is
already opened, and if yes, i start
to loop until the docfile is free, then
do the replace ...

OK, solved it 'lowlevel' with

File.exists?('~$foobar.doc')

means, if the file is already opened, there is
a corresponding file with leading ~$ before
the orginal filename, i.e. ~$foobar.doc

Regards, Gilbert