Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everyone,
I'm trying to open an Excel doc in my program which was written in VB.NET and it returns the error "Object reference not set to an instance of an object" when I try to use the Workbooks.Open function. This actually works fine when I use my program on a machine that has Excel XP installed, but when I move to a machine with Excel 2000, I get this error. My code looks something like this: Dim exl as Excel.Application Dim wrkBKs as Excel.Workbooks Dim wrkBK as Excel.Workbook exl = New Excel.Application() wrkBKs = exl.Workbooks wrkBK = wrkBKs.Open("somefile.xls") The error occurs on the last line. I also have similar code which does pretty much the same thing with MS Word, and the Open function works fine on a machine with Word 2000, and Word XP. If anyone has any ideas, I'd love to hear them. Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Knowing nothing about VB.NET doesn't stop me. Does this works:
exl = New Excel.Application() wrkBK = exl.Workbooks.Open("somefile.xls") -- Jim Rech Excel MVP |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tried that! Same problem.
I just did one more test, though...I made all of my variables objects and just did late binding on everything and it works. I'd obviously rather use early binding for everything, but if I can't get that to work then I guess I'm stuck with that solution. I appreciate the quick reply! -----Original Message----- Knowing nothing about VB.NET doesn't stop me. Does this works: exl = New Excel.Application() wrkBK = exl.Workbooks.Open("somefile.xls") -- Jim Rech Excel MVP . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
GetOpen filename to open files(Workbooks) | Excel Discussion (Misc queries) | |||
Workbooks.Open Filename:=.UpdateLinks:=0, IgnoreReadOnlyRecommended:=True | Excel Discussion (Misc queries) | |||
Workbooks.Open Filename | Excel Worksheet Functions | |||
set filename to <filename-date on open | Excel Worksheet Functions | |||
vlookup and filename returning same result on each sheet. | Excel Discussion (Misc queries) |