New to .net - Excel question

  • Thread starter Thread starter Kay
  • Start date Start date
K

Kay

Hi All,

After I upgrade my vb6 app to dot net I got the following error:

=============
If .Cells._Default(iRow, 1) = "blar" Then
or
If .Cells(iRow, 1) = "blar" Then

An unhandled exception of type 'System.InvalidCastException' occurred in
microsoft.visualbasic.dll

Additional information: Operator is not valid for type 'Range' and string
"blar".
===============

Can someone show me how to read and write excel file using the excel object
instead of using ADO? Coz the app will manipulate the worksheet a lot and I
feel that using the excel object is a bit easier to access to a particular
cell (and save me some time to re-write the sub)...

Thanks in advance~

Kay
 
Hi,

If .Cells(iRow, 1) .ToString= "blar" Then


Ken
---------------------
Hi All,

After I upgrade my vb6 app to dot net I got the following error:

=============
If .Cells._Default(iRow, 1) = "blar" Then
or
If .Cells(iRow, 1) = "blar" Then

An unhandled exception of type 'System.InvalidCastException' occurred in
microsoft.visualbasic.dll

Additional information: Operator is not valid for type 'Range' and string
"blar".
===============

Can someone show me how to read and write excel file using the excel object
instead of using ADO? Coz the app will manipulate the worksheet a lot and I
feel that using the excel object is a bit easier to access to a particular
cell (and save me some time to re-write the sub)...

Thanks in advance~

Kay
 
Thanks Ken~

Can someone also point me to a resource with the excel object example too?
Coz there are few more problmes and would like to learn more, thanks !!

Kay
 

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

Back
Top