ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error Opening Excel File in VB.NET (https://www.excelbanter.com/excel-programming/363053-error-opening-excel-file-vbulletin-net.html)

Luc[_3_]

Error Opening Excel File in VB.NET
 
Hi, I have an application that reads in a bunch of values from an excel
application. Now this works fine on my computer but when I deploy it to a few
other computers, some of them return an 'Object Reference not set to an
instance of an object' error when I open it.

Here is my code....

Dim ExcelApp As Excel.Application
Dim ExcelBook As Excel.Workbook

ExcelApp = New Excel.Application
ExcelBook = ExcelApp.Workbooks.Open(Filename) ' error is here

I've narrowed it down to this only happening on computers with an older
version of Excel than I have currently installed. Does anyone know why this
happens and a solution that doesn't involve me installing an older version of
Excel?

Thanks,

Luc

rox.scott

Error Opening Excel File in VB.NET
 
You can build your app against a lower version of Excel and have it work
across all versions. See "Achieving Backward Compatibility with .NET
Interop: Excel as Case Study" -
http://www.devcity.net/Articles/163/1/article.aspx

--scott


--


"Luc" wrote:

Hi, I have an application that reads in a bunch of values from an excel
application. Now this works fine on my computer but when I deploy it to a few
other computers, some of them return an 'Object Reference not set to an
instance of an object' error when I open it.

Here is my code....

Dim ExcelApp As Excel.Application
Dim ExcelBook As Excel.Workbook

ExcelApp = New Excel.Application
ExcelBook = ExcelApp.Workbooks.Open(Filename) ' error is here

I've narrowed it down to this only happening on computers with an older
version of Excel than I have currently installed. Does anyone know why this
happens and a solution that doesn't involve me installing an older version of
Excel?

Thanks,

Luc



All times are GMT +1. The time now is 04:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com