232showtime Posted October 15, 2014 Share Posted October 15, 2014 (edited) I want to rangeread B14 to B26, by pressing F9.. like if i press F9 will read B14 and by pressing F9 again will read next cell B15, but i dont have any idea to rangeread the next cell using F9 again. is it possible? HotKeySet("{F9}", "Copy") Func Copy() If WinActivate("[CLASS:XLMAIN]") Then Local $sText = WinGetTitle("[ACTIVE]") $iText = StringLeft($sText, 16) Local $sWorkbook = $iText & ".xlsx" $oWorkbook = _Excel_BookAttach($sWorkbook, "filename") Local $sResult = _Excel_RangeRead($oWorkbook, Default, "B14") ControlSetText("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", $sResult) EndIf Endfunc Edited October 15, 2014 by 232showtime ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
Solution water Posted October 15, 2014 Solution Share Posted October 15, 2014 A simple exampleto get you started F9 starts the script, F10 ends the script. The cell is being written to the Console. It starts with B14 but does not stop reading when B26 is being reached. #include <Excel.au3> #include <StringConstants.au3> HotKeySet("{F9}", "_Copy") HotKeySet("{F10}", "_Exit") Global $iStart = 13, $iEnd = 26, $iIndex = $iStart While 1 Sleep(10) WEnd Func _Copy() If WinActivate("[CLASS:XLMAIN]") Then Local $sTitle = WinGetTitle("[ACTIVE]") Local $aTitle = StringSplit($sTitle, " - ", $STR_ENTIRESPLIT) $oWorkbook = _Excel_BookAttach($aTitle[2], "filename") Local $sResult = _Excel_RangeRead($oWorkbook, Default, "F" & $iIndex) $iIndex = $iIndex + 1 ConsoleWrite($sResult & @CRLF) ; ControlSetText("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", $sResult) EndIf EndFunc ;==>_Copy Func _Exit() Exit EndFunc ;==>_Exit 232showtime 1 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now