Excel 2000 and VB.Net

P

Peter Bons

Hi all,

I have this really annoying problem while trying to access an excel file.
I understand that I can't use the interop system, because that only applies
to office XP/2003 (saidly enough) so I am stuck whit the traditional COM
objects.

In my available references I have only the Microsoft Excel 5.0 reference
available (I am developing on an XP machine with Office2003 but my client
uses Office 2000)

So, using the 5.0 object gives me lots of troubles,

This is my code so far:
1 myExcelApp = CreateObject("Excel.Application")
2 myExcelApp.Interactive = False
3 myExcelApp.Visible = False
4 myExcelApp.DisplayAlerts = False
5 myWorkbook = myExcelApp.Workbooks.Open(aFilename)
6 myWorksheet = myWorkbook.Worksheets(1)
7 wijkcode = CType(myWorksheet.Cells.Item(count, 2), Excel.Range).Value

This gives me "member does not exists" errors starting at line 5
What I can do to get my desired value in line 7 is this:

wijkcode =
CType(CreateObject("Excel.Application").Workbooks.Open(aFilename).Worksheets(1).Cells.Item(count, 2), Excel.Range).Value

With this line I do not get any "missing members" errors anymore but my app
is incredible slow of course, because each time a new excel object is
generated.

Now what is THE solution for me in this case?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top