Is document in use?

B

Brian Abbott

How can I tell if an XLS file is already in use by another user / instance
of Excel when I open it via automation?

TIA

Brian Abbott
 
P

Peter Huang

Hi Brian,

I have searched the Excel object modal, it seems that there is no
automation to tell use if certian file is in use.
Because by default automation will open a excel file in read-write mode,
but if the file is in use, it will be opened in read-only status.
So we can check if the workbook is opened as read-only to judge if the file
is used by another excel application.
Also we can use WMI to check which process opened the file.
http://groups.google.com/groups?hl=zh-CN&lr=&c2coff=1&selm=uu6aCba8DHA.2064%
40TK2MSFTNGP11.phx.gbl

If you still have any concern on this issue, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Y

Yan-Hong Huang[MSFT]

Hi Brian,

A stable way is to attach to a running instance of Excel (if any in the
system) and then iterate the ROT looking for a specific document.

The sample code and detailed description can be found at:
"HOWTO: Attach to a Running Instance of an Office Application"
http://support.microsoft.com/?id=238975

Thanks.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
-http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
p&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top