Can someone help me for the right staement to read a cell with prepare statement
I use
hStatement = comate::COMate_PrepareStatement("Cells(" + Str(@i) + " As long BYREF," + Str(@j) + " As long BYREF)")
and for reading
ExcelObject\GetStringProperty("",hStatement)
But this isn't work and generate an error
Here and example
Code: Select all
XIncludeFile #PB_Compiler_Home+"comate\COMatePLUS.pbi"
Global.comateobject ExcelObject,Workbook,WorkSheet,Range,Sheet
;========================================
; Prepare statements
;========================================
hStatement = COMate_PrepareStatement("Cells(" + Str(@i) + " As long BYREF," + Str(@j) + " As long BYREF)")
fichier.s= "xxx.cls" ; nom du fichier a changer
ExcelObject = COMate_CreateObject("Excel.Application")
ExcelObject\SetProperty("Visible = #True")
Delay(5000)
ExcelObject\SetProperty("DisplayAlerts=1")
excelObject\SetProperty("ScreenUpdating = #true")
If ExcelObject
WorkBook = ExcelObject\GetObjectProperty("Workbooks\Open("+"'"+fichier+"',0)")
i=1
Workbook\Invoke("Sheets('feuil1')\Select") ;nom de la feuille a changer
debut=#True
message.s=""
Repeat
i=3
J=0
Debug ExcelObject\GetStringProperty("",hStatement)
Debug COMate_GetLastErrorDescription()
i+1
If i=4;on sort de la boucle ne faire le test que pour la premiére ligne
Break
EndIf
ForEver
ExcelObject\Invoke("ActiveWorkbook\Close(0)")
ExcelObject\SetProperty("Displayalerts = #True")
ExcelObject\Invoke("Quit")
Workbook\Release()
ExcelObject\Release()
EndIf