View Single Post
Old December 6th, 2013, 04:19 AM
RedDotVasilyev RedDotVasilyev is offline
Registered User
Points: 18, Level: 1
Points: 18, Level: 1 Points: 18, Level: 1 Points: 18, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2013
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Unable to open excel file thru

Hi, just to add to a caveatashish's answer, when you are finished with your spreadsheet’s tasks it is not enough to close the file. You need to release every COM object which was created and quit the application, you can read more about this on this discussion:
xlApp = Nothing
Also you can try this simpler approach with a help of this VB.NET library, it has an easy to use API for reading an excel file in .NET and you will not have to bother with releasing the COM objects from the memory.
Dim xlWorkBook As ExcelFile = ExcelFile.Load("c:\test1.xlsx")
Dim xlWorkSheet As ExcelWorksheet = xlWorkBook.Worksheets("sheet1")