Opening Excel Sheet in Win 2000 using VB .Net

sau124

New member
Joined
Mar 24, 2005
Messages
1
Programming Experience
1-3
Hello Guys,

I have this code for opening an excel sheet using VB .Net with Excel 2000/2003. The code works fine with Win XP but gives me an error that
"Object reference not set to an Instance of an Object"

I am using the following code...

Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim oRng As Excel.Range
oXL = CType(CreateObject("Excel.Application"), Excel.Application)
oXL.Visible = True
oWB = oXL.Workbooks.Open(dlg.FileName)
oSheet = oWB.ActiveSheet

Any help will be highly appreciated.

Thanks,

Saurabh
 
Top Bottom