02-03-2012, 12:22 PM
yes, useful
this should be OK?
Member function ExcelSheet.Find
this should be OK?
Member function ExcelSheet.Find
function! `what ARRAY(Excel.Range)&aFound [flags] [$range] ;;flags: 1 match case, 2 match entire cell, 4 find all, 8 within workbook, 16 by columns, 0x100,0x200 look in (0 formulas, 0x100 values, 0x200 comments)
;Finds cells.
;Returns: 1 found, 0 not found.
;what - text to search for.
;aFound - variable for results.
;flags - find options. The same as in Excel Find dialog. Some flags:
;;;4 - find all matching cells. If not set, finds the first matching cell, and aFound will have 1 element.
;;;8 - search in all worksheets of this workbook. If not set - in this worksheet only.
;range - part of worksheet where to search. Default: "" - all. <help>Excel range strings</help>.
;Added in: QM 2.3.3.
;EXAMPLES
;;find single cell containing "c"
;ExcelSheet es.Init
;ARRAY(Excel.Range) a
;if(!es.Find("c" a)) out "not found"; ret
;;show results
;out a[0].Value; out a[0].Column; out a[0].Row
;;find all cells containing "c"; search in all worksheets
;ExcelSheet es.Init("" 16)
;ARRAY(Excel.Range) a; int i
;es.Find("c" a 4|8)
;;show results
;for i 0 a.len
,;Excel.Range r=a[i]
,;Excel.Worksheet w=r.Parent
,;str sWS(w.Name) sAddr(r.Address(0 0 1))
,;out "%s: %s (R%iC%i)" sWS sAddr r.Row r.Column
,;w.Activate; r.Activate
,;1
... (code not included now)