Jump to content

Recommended Posts

Posted

Hi.

I used this for a long time:

$row=$oExcel.ActiveSheet.UsedRange.Rows.Count

But in version 3.3.12.0 (1st June, 2014) (Release) Excel UDF was re-written and this code stopped working. I see this:

"D:\Dropbox\Test.au3" (8) : ==> Variable must be of type "Object".:

Is there any solution? Thanks.

Posted

Now trying to put some Value into cell I see:

"C:\Program Files (x86)\AutoIt3\Include\Excel.au3" (876) : ==> Illegal text at the end of statement (one statement per line).:
Func _Excel_RangeWrite($oWorkbook, $vWorksheet, $vValue, $vRange = Default, $bValue = Default, $bForceFunc = Default)
Func _Excel_RangeWrite($oWorkbook, $vWorksheet, $vValue, $vRange = Default, $bV^ ERROR

Using 

_Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F2")
Posted

Can you please post the full script? Most of the time the error is caused somewhere else (missing quote etc.).

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

Posted

Here it is:

#include <Misc.au3>
#Include <File.au3>
#Include <Array.au3>
#include <Excel.au3>
#include <Math.au3>
$oExcel1 = _Excel_Open(False)
$oExcel = _Excel_BookOpen ($oExcel1,"D:\Dropbox\Gold10.xls", 0)
$row=$oExcel.ActiveSheet.UsedRange.Rows.Count
$SilvemoonA=Int(_Excel_RangeRead ($oExcel, Default , "C" & $row)/1000)
$KazzakH=Int(_Excel_RangeRead ($oExcel, Default , "E" & $row)/1000)
$DraenorH=Int(_Excel_RangeRead ($oExcel, Default , "G" & $row)/1000)
$RavencrestA=Int(_Excel_RangeRead ($oExcel, Default , "I" & $row)/1000)
$FrostmaneA=Int(_Excel_RangeRead ($oExcel, Default , "K" & $row)/1000)
$SylvanasA=Int(_Excel_RangeRead ($oExcel, Default , "M" & $row)/1000)
$RagnarosH=Int(_Excel_RangeRead ($oExcel, Default , "O" & $row)/1000)
$TwistingNetherH=Int(_Excel_RangeRead ($oExcel, Default , "Q" & $row)/1000)
_Excel_BookClose($oExcel)
$oExcel = _Excel_BookOpen ($oExcel1,"D:\Dropbox\gold_stock.xls", 0)
_Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $DraenorH, "C2")
If $DraenorH>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F2") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F2")
_Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $FrostmaneA, "C3")
If $FrostmaneA>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F3") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F3")
_Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $KazzakH, "C4")
If $KazzakH>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F4") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F4")
_Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $RagnarosH, "C5")
If $RagnarosH>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F5") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F5")
_Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $RavencrestA, "C6")
If $RavencrestA>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F6") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F6")
_Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $SilvemoonA, "C7")
If $SilvemoonA>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F7") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F7")
_Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $SylvanasA, "C8")
If $SylvanasA>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F8") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1,"F8")
_Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $TwistingNetherH, "C9")
If $TwistingNetherH>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F9") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F9")
_Excel_BookClose($oExcel)
_Excel_Close($oExcel1, True, True)
Posted

You can't have If / Then / Else on the same line.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

Posted

If you select "Syntax Check" in SciTE you should get error messages showing you where to change your script.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

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...