procedure TForm3.BitBtn1Click(Sender: TObject); var Cell: TCellAddress; Xls: TExcelFile; begin Cell := TCellAddress.Empty; // initialize the value to null to start searching.
Xls := TXlsFile.Create('d:\test.xls', false); try Cell := Xls.Find(Edit1.Text, TXlsCellRange.Null, Cell, false, true, true, false); if not Cell.isnull then showmessage(Cell.CellRef); finally FreeAndNil(Xls); end;
NULL (C) = NIL (Delphi) ---------- to Variants try this:
procedure TForm1.Button1Click(Sender: TObject); var x: Variant; begin // x := null; // // if Assigned(x) then = it's incompatible types // if x = null then ShowMessage('x = null') else ShowMessage('x = not null'); end;
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
see if the function: Function ExcelFind( Excel : Variant; FindString : ShortString): Boolean;
is in "type lib" file or it is in "Excell language" (VBS)
in Delphi you can use: ---> Component -> Import Component .... to create a "LIB" (a unit .PAS with all internal definitions in a DLL in your system, like DLL from Excel)
if the function is directly from Excell DLL, then, your Object created in your project, automatically recognize it or not when it was used, in case (function "ExcelFind") if it exists, then ok, ELSE = error!
using a "Import Component" the Delphi allow create a "component in your Delphi - Pallete, like TButton for example).
in your case, I think that Expert-Exchange use "Import Component" to create a "TLB" (.pas file)
exists some "xxxx_TLB.pas" in your unit files?
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
for "Variants" is correct verify if "= UNKNOWN" and using "VarIsClear()" can help too! of course!
because a "Variant" same dont used, appoint to "some" = pointer to something" (same that "nothing") --> Variant will be always a "pointer to something"
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
DesRange:=ExcelApp.WorkSheets[1].Cells.Find('抬头第1/1页'); if VarIsType(DesRange,varDispatch) and Assigned(FindVarData(DesRange).VDispatch) then ShowMessage('找到了') else ShowMessage('没找到');
----------------------------------------------
-