Jump to content
Sign in to follow this  
Enyahs

Object error when creating graphs on excel.

Recommended Posts

Enyahs

Hello,

I am trying to create a graph on the same sheet as the data. Here is the code.

#include <Excel.au3>

#include <Misc.au3>

Local Const $xlRows = 1

Local $xLabel = "TIME"

Local $yLabel = "BW-OUT"

Local $oExcel1 = "\Sample.xls"

$oExcel = _ExcelBookOpen($oExcel1,1,1)

$oExcel.Range("C3").Select

$oExcel.Selection.CurrentRegion.Select

$oRange = $oExcel.Selection.Address

$sSheetName = $oExcel.ActiveSheet.Name

$oExcel.ActiveSheet.ChartObjects.Add(1350, 30, 500, 500).Select

$oExcel.Application.CutCopyMode = False

$oExcel.ActiveChart.ChartWizard($oExcel.Sheets($sSheetName).Range($oRange), $xlLine, 4, $xlRows, 1, 2, 1, $sSheetName, $xLabel, $yLabel)

It was running successfully last week, but now I am getting the error: Variable must be of type "Object" on this code

$oExcel.Selection.CurrentRegion.Select

$oExcel^ ERROR

Hope you could help me. Thank you.

Share this post


Link to post
Share on other sites
PsaltyDS

Add some error checking for _ExcelBookOpen(). Test with IsObj($oExcel) before continuing. Maybe the path is not valid to the file, or the file no longer opens as a valid workbook.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Enyahs

Add some error checking for _ExcelBookOpen(). Test with IsObj($oExcel) before continuing. Maybe the path is not valid to the file, or the file no longer opens as a valid workbook.

;)

Thank you for your response Psalty DS! :evil:

I tried adding an error checking, now I am getting this error.

\AutoIt3\Include\IE.au3 (238) : ==> The requested action with this object has failed.:

$o_object.visible = $f_visible

$o_object.visible = $f_visible^ ERROR

I checked IE.au3 but I have not used the function _IECreate. :evil:

Thank you.

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.