Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Reading an Excel sheet and returning adjacent cells

$
0
0

I'm fairly new to AutoIt and I'm getting in the groove of it all, but I'm needing a little bit of help. Before I post the code I have for you all to ridicule me on, let me tell you what I'm wanting to do. I have an input box that I enter a PC name in. When I hit my search button, I have a function that returns the print group(s) that the PC is in (in what I have named as $List1 right now). What I am wanting to do is be able to click the print group via MouseGetPos and have that run another function to search through an Excel file that is stored via the intranet. The print groups will be in column A in the sheet and I want to return the printer in column B and C and put it in a second list box (what is named $List2).

 

I've run into a rut trying to get this working, I've checked out the help files and rummaged through the forums. And here is my code, please be gentle. Any help is appreciated and guidance is welcome!

Local $oExcel = _ExcelBookOpen("http://intranet sheet.xls") Local $aArray = _ExcelReadSheetToArray($oExcel)    $sSearch = guictrlread($List1) MouseGetPos(0) & MouseGetPos(1)    $row = UBound($aArray)    $column = UBound($aArray, 2)    $iIndex = _ArraySearch($aArray, $sSearch, "", "", "", "", $Column, $row)      Local $pGroup = _ExcelReadCell($oExcel, $row, 1) ;pGroup is the print group.  Local $mPrinter = _ExcelReadCell($oExcel, $row, 2) ;mPrinter is the main printer.  local $sPrinter = _ExcelReadCell($oExcel, $row, 3) ;sPrinter is the secondary printer.    GUICtrlSetData($List2, $mPrinter, $sPrinter)

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>