carol chen

Hi, everyone. i am doing a simple windows app which connects to an Excel (2003) file on our server. the file is shared. the connection and reading contect are working fine now, but I wanna check if the file is in use before opening it. becouse I also have a function which writes new records into the file, and if it's used by another user, i can only save by using another name or replace the existing file.

Is there anyone knows how to carry out the detection Thanks in advance!

carol




Re: Visual Studio Tools for Office How to check if the Excel file is in use by another person

Ji Zhou ¨C MSFT

Hi Carol,

I do not know how did you connect to the Excel file If you are using OLEDB to connect and get the content of excel file as it is a data source, I think you are in a wrong forum. And if you are using Office automation to manipulate your excel file, there is a property named UserStatus of the Excel.Workbook object. This property tells information about each user who has the workbook open as a shared list.

To get more information, you can refer this link:

http://msdn2.microsoft.com/en-us/library/bb221986.aspx

Thanks

Ji