Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Cannot Open Excel File (already open)
posted

I am using FileSystemWatcher to monitor an excel file on the network and to display any changes on screen.

However, because the end user has the excel file open, everytime they save it the following code generates an error:

Dim

 

 

workbook As Infragistics.Documents.Excel.Workbook = Infragistics.Documents.Excel.Workbook.Load(ResultsFile)

worksheet = workbook.Worksheets(MeetingDate)

Error generated: The process cannot access the file 'C:\Users\Chris\Documents\2012\2012 Results.xls' because it is being used by another process.

My question is, how can I open the excel document read only?

Thanks