AutoHotKey Excel - Grabbing data from excel with AHK
Описание
Here we will look at three ways to gather data from an excel file. And best part is you dont even have to have excel open to grab data.
CODE:
f9::
FilePath = X:\Desktop\ppl.xlsx"
oWorkbook := ComObjCreate("Excel.Application")
oWorkbook.Workbooks.open(FilePath,, readonly := true)
oWorkbook.Visible := 0
clientsname := oWorkbook.Worksheets("test doc").Range("A3").Value
StringRight, clientsname, clientsname, 5
clientsphone := oWorkbook.Worksheets("test doc").Range("B3").Value
clientsstate := oWorkbook.Worksheets("test doc").Range("C3").Value
clientsfax := oWorkbook.Worksheets("test doc").Range("D3").Value
Xl.Quit()
finalinfo=
(
load completed
Clients name is %clientsname%
Clients phone is %clientsphone%
Clients state is %clientsstate%
Clients fax is %clientsfax%
)
msgbox, %finalinfo%
return
f10::
vararr=0
{
xcl := ComObjActive("Excel.Application")
reminderList := []
loop
{
bodyText := xcl.Range("A" . A_Index + 1).value
vararr++
varsavedname%vararr%=%bodyText%
if (bodyText = "")
break
}
Msgbox, Load completed row 4 info is %varsavedname3% ---- Final row is %vararr%
}
Return
f11::
{
vararr=0
xcl := ComObjActive("Excel.Application")
reminderList := []
loop
{
bodyText := xcl.Range("A" . A_Index + 1).value
vararr++
varsavedname%vararr%=%bodyText%
if (bodyText = "12345 Thom")
break
}
oWorkbook := ComObjCreate("Excel.Application")
oWorkbook.Workbooks.open(FilePath,, readonly := true)
oWorkbook.Visible := 0
Xl.Quit()
vararr++
Msgbox, Thom found at line %vararr%
}
Return
Рекомендуемые видео


















