Jump to content
232showtime

_Excel_RangeRead help

Recommended Posts

232showtime

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
water

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.

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
232showtime

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
water

$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 (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
232showtime

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
water

Which $ sign?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
232showtime

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
water

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 (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
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

×