Jump to content

_Excel_RangeRead help


Go to solution Solved by water,

Recommended Posts


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 by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to post
Share on other sites
  • Solution

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...