By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,165 Members | 1,502 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,165 IT Pros & Developers. It's quick & easy.

New to .net - Excel question

P: n/a
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


Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

If .Cells(iRow, 1) .ToString= "blar" Then
Ken
---------------------
"Kay" <kk@micxsoft.com> wrote in message
news:eh**************@TK2MSFTNGP10.phx.gbl...
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



Nov 21 '05 #2

P: n/a
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

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uk**************@TK2MSFTNGP09.phx.gbl...
Hi,

If .Cells(iRow, 1) .ToString= "blar" Then
Ken
---------------------
"Kay" <kk@micxsoft.com> wrote in message
news:eh**************@TK2MSFTNGP10.phx.gbl...
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


Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.