Jump to content

Recommended Posts

Posted

I'm trying to read text from an excel sheet and this is what I have it reads the range as 0 instead of the text in the excel.

Global $oTestExcel = _Excel_Open()
_Excel_BookOpen ( $oTestExcel, @ScriptDir & "\Autoit Excel Test.xlsx" )
local $Attachment1 = _Excel_RangeRead($oTestExcel, 1, "C2", 3)
local $Attachment1type = _Excel_RangeRead($oTestExcel, 1, "D2", 3)
MsgBox($MB_SYSTEMMODAL, "Title", $Attachment1)

This seems really simple and I think it should work. Why is it reading a 0?

Posted (edited)

You should read the helpfile on _Excel_RangeRead specifically the parameters: _Excel_RangeRead($oWorkbook,...

#include <Excel.au3>

Local $oExcel = _Excel_Open()
Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\Autoit Excel Test.xlsx" )
Local $sAttachment1 = _Excel_RangeRead($oWorkbook, Default, "C2", 3)
local $sAttachment1Type = _Excel_RangeRead($oWorkbook, Default, "D2", 3)
MsgBox(4096, "Excel Data", "Attachment1: " & $sAttachment1 & @CRLF & "Attachment1 Type: " & $sAttachment1Type & @CRLF)

 

Edited by Subz

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
×
×
  • Create New...