Ich versuche mit diesem Skript, Suchbegriffe aus einer "Excel-Datei" in einer "Word-Datei" zu finden und danach das Ergebnis in Excel (neue Arbeitsblatts) zu schreiben.
Code: Select all
#NoEnv
#Persistent
#SingleInstance,Force
#NoTrayIcon
#!h::
{
oWord := ComObjActive("word.application")
oWord.Selection.WholeStory
var := oWord.selection.text
msgbox % var
Xl := ComObjActive("excel.application")
arr := [],colcnt := Xl.Activesheet.UsedRange.Columns.count
for c in Xl.Activesheet.UsedRange.Columns(1).Cells
if instr(var,c.value)
arr.push(c.entirerow.value)
path := "C:\xxx\test2.xlsx"
wrkbk := Xl.workbooks.open(path)
nwsht := wrkbk.activesheet
for a,b in arr
;msgbox % a
nwsht.range(nwsht.cells(a,1),nwsht.cells(a, colcnt)) := b
;msgbox % b
return
}
Vielen Dank!