While reading excel file i am getting null values

A

Aruna Tennakoon

Hi guys,

I am writing a program to import data from a excel file
using a MS Visual Basic 6.0.
I am using "Microsoft.Jet.OLEDB.4.0" as the provider. While I am reading the
excel file I am getting null values for some fields which is not null in the
excel file. Can any one help me to resolve this please.

Thanks,
-Aruna
 
P

Patrick Molloy

Why not set a ref to the excel obj library the just open
the workbook ? That way you can manipulate the worksheet
object etc etc

dim xl as excel.application
dim wb as excel.workbook
dim ws as excel.worksheet
dim cell as excel.range

set xl = new excel.application
set wb = xl.workbooks.open(ThisWorkbook)
set ws = wb.activesheet

....do something with the sheet..
for each cell in ws.Range("C3:K12")
...blah
Next
...
...
wb.close false ' close the book without saving
xl.quit
set ws = nothing
set wb = nothing
set cell = nothing
set xl = nothing


HTH

Patrick Molloy
Microsoft Excel MVP
 
Top