Discussion:
Excel: find text in range
(too old to reply)
Profil1
2003-07-16 14:11:27 UTC
Permalink
See that VarIsEmpty and VarIsNull are both false for your Found results:
$0016EEEC and $00000000 also.

Try to use VarIsClear(Found) function.

Mario
Hi all,
I want to search text in all cells of a Excel sheet.
var
Found, Searchtext : OleVariant;
begin
Found := WorkSheet.Range['A1', 'F99'].Find(
SearchText,
EmptyParam,
Lookin :=
xlValues,
Lookat :=
xlPart);
if not VarIsEmpty(Found) and not VarIsNull(Found) then
DoSometing;
The debugger shows me Found = $0016EEEC (if text is really found)
and Found = $00000000 (if text isn't found).
The problem for me is that DoSometing is called always. Although
searchtext
is not found in that sheet.
How can I solve this ?
So long,
Thomas
Thomas Wormser
2003-07-17 06:05:10 UTC
Permalink
Yep, that's it. And it does work now.
Thanks Mario

Bye,
Thomas
Post by Profil1
$0016EEEC and $00000000 also.
Try to use VarIsClear(Found) function.
Mario
Hi all,
I want to search text in all cells of a Excel sheet.
var
Found, Searchtext : OleVariant;
begin
Found := WorkSheet.Range['A1', 'F99'].Find(
SearchText,
EmptyParam,
Lookin :=
xlValues,
Lookat :=
xlPart);
if not VarIsEmpty(Found) and not VarIsNull(Found) then
DoSometing;
The debugger shows me Found = $0016EEEC (if text is really found)
and Found = $00000000 (if text isn't found).
The problem for me is that DoSometing is called always. Although
searchtext
is not found in that sheet.
How can I solve this ?
So long,
Thomas
Loading...