Excel Automation Problem: 'Public Member "Find" on type "Range" not found'

L

Lenonardo

Hi.

I'm writing a VB.Net application to update multiple Excel Worksheets.

I'm using late binding (i.e. all variables are objects + use
createobject)

I develop the application on an XP machine with Excel 2002 (version 10.0)
installed - and the code works fine.
I then test the code on a laptop running Excel 2000 (version 9.0) and it
bombs out with the above error on the ***starred*** statement below in
the following code:

---------------------------------------------------------------------
Private Const xlFormulas = &HFFFFEFE5
Private Const xlWhole = 1
Private Const xlDown = &HFFFFEFE7
Private Const xlToLeft = &HFFFFEFC1
Private Const xlToRight = &HFFFFEFBF
Private Const xlUp = &HFFFFEFBE
Private Const xlPatternSolid = 1
Private Const xlByColumns = 2
Private Const xlByRows = 1
Private Const xlNext = 1
Private Const xlPrevious = 2

.......

Private Function read_job_numbers(ByRef ws As Object, ByRef jobs_el As
XmlElement) As Boolean
Dim cell As Object
Dim xml_el As XmlElement
Dim val As String
Dim nextitem As Object
Dim ck_el As XmlElement

log.add_msg("Reading Jobs", sev:=0)

cell = ws.Range("A4")
While cell.Text <> ""
cell_fmt(cell)
xml_el = xml.CreateElement("JOB")
xml_el.SetAttribute("rownumber", cell.Row)
val = cell.Value
xml_el.InnerText() = val.ToLower
jobs_el.AppendChild(xml_el)
cell = cell.Offset(1, 0)
End While
'***********************************************************
'***** The next statement generates the error *************
'***********************************************************
nextitem = ws.Cells.Find(What:="proposals", _
After:=cell, _
LookIn:=xlFormulas, LookAt:=xlWhole, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
'***********************************************************
If (nextitem Is Nothing) Then
log.add_msg("Can't find 'Proposals' row", sev:=3)
Return False
End If
-------------------------------------------------------------
I've tried using other range objects apart from ws.cells - all with the
same result.

Can anyone explain why this is happening as it is driving me nuts.

Thanks
 
L

Lenonardo

Hi.

I'm writing a VB.Net application to update multiple Excel Worksheets.

I'm using late binding (i.e. all variables are objects + use
createobject)

I develop the application on an XP machine with Excel 2002 (version
10.0) installed - and the code works fine.
I then test the code on a laptop running Excel 2000 (version 9.0) and
it bombs out with the above error on the ***starred*** statement below
in the following code: ....
'***********************************************************
'***** The next statement generates the error *************
'***********************************************************
nextitem = ws.Cells.Find(What:="proposals", _
After:=cell, _
LookIn:=xlFormulas, LookAt:=xlWhole, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
'***********************************************************
If (nextitem Is Nothing) Then
log.add_msg("Can't find 'Proposals' row", sev:=3)
Return False
End If
-------------------------------------------------------------
I've tried using other range objects apart from ws.cells - all with
the same result.

Can anyone explain why this is happening as it is driving me nuts.

Thanks

Just found waht was causing this error message (typically unhelpful).
Excel 2000 does not support the argument 'SearchFormat' !!!!

(If only Microsoft messages were more helpful)
 
O

One Handed Man

Dont knock it, that's what keeps you and I in work !

Except that I'm not working for the last 6 weeks, but that's another story,
glad u fixed it.

Regards - OHM
 

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