Problem with Excel.Workbook.open

barse

Member
Joined
Jan 20, 2005
Messages
6
Programming Experience
5-10
Hi,
I'm opening an excel doc in vb.net with Excel 2002 on my (xp)machine. Doing this I have no problems. This is also my dev machine.

When I run my app on a win2000 machine running Excel 2000 I get an "Object reference not set to an instance of an object. at this line
wb = objExcel.Workbooks.Open(filename)

Here are my declarations:-

Private wb As Excel.Workbook
Private objExcel As New Excel.Application


Any Ideas?

 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
You probably have a reference to the Office11 library. Each version of Excel has it's own COM library to use for automation. Excel 2000 uses the Office10 library.

If you want to use different versions of Excel, you'll have to use late binding.

Here's an example for Word, Excel should be similar: Starting Word *without* a reference to the OCX/DLL
 
Top Bottom