232showtime

_Excel_RangeRead help

8 posts in this topic

#1 ·  Posted (edited)

how to read single active cell, like for example

;; i will click on B33 or I will move the selection from B40 to B33 using arrow keys then do my script

$ClickedCell = ""

HotKeySet("{F1}", "Read")

Func Read()

Local $sText = WinGetTitle("[CLASS:XLMAIN]")
$iText = StringLeft($sText, 5)
Local $sWorkbook = $iText & ".xlsx"
$oWorkbook = _Excel_BookAttach($sWorkbook, "filename")
Local $sResult = _Excel_RangeRead($oWorkbook, Default, $ClickedCell)
MsgBox(0, "Excel", $sResult)


EndFunc

how will i get the data from $ClickedCell ??? except for ctrl+v

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.

Share this post


Link to post
Share on other sites



I do not see _Excel_Open in your code.

To get the active cell you would use $oExcel.ActiveCell. $oExcel is the application object as returned by _Excel_Open.

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

book1.xlsx is already open and i used book attach to get application obj. could you give me example about $oExcel.ActiveCell its kinda new to me dont know where to start.. pleaaaaaasssseeee o:) o:) o:)


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.

Share this post


Link to post
Share on other sites

$oExcel.ActiveCell gives you the active cell of the active sheet in the active workbook.

Means: The cell the user selected by clicking on it.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

got it... found and modified some examples here in forum but how to remove the $ sign???

Global $CellNo

HotKeySet("{F1}", "Read")
$oExcel = ObjGet("", "Excel.Application")

While 1
    Sleep(100)
WEnd

Func Read()

    $active = $oExcel.ActiveCell.Address
    If $CellNo <> $active Then
        $CellNo = $active
        MsgBox(0, "Success", "Range is : " & $active )
    EndIf

EndFunc   ;==>Read
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.

Share this post


Link to post
Share on other sites

Which $ sign?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

if you run my script message box will pop out and will say, Range is : $A$232....  $ sign in message box output...

I want to get only the text, like, Range is : A232

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.

Share this post


Link to post
Share on other sites

That's an absolute cell reference.

Please have a look at function _Excel_ConvertFormula to convert it to a relative reference.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


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