Jump to content

Excel Chart Series XValue and Value Question


Recommended Posts

Hi everyone!

I'm Working on a Excel project including many Charts added dynamically into sheets.

So far so good I can add the charts where I want and add series to them (I'm talking about charts of the style "Line with markers)

Usually in VBA I can set those values on a serie:

XValues = someRange

Values = someRange

Here's my code:

$oChartRng = $oSheet2.Range("H" & $oStoreDataDestRng.Row & ":P" & $iStoreAvgRow)
        $oNewChart = $oSheet2.ChartObjects.Add($oChartRng.Left, $oChartRng.Top, $oChartRng.Width, $oChartRng.Height)
        $oChart = $oNewChart.Chart
        $oChart.ChartType = 65
            
        
        For $j = 1 to 4
            $oNewChartSerie = $oChart.SeriesCollection.NewSeries ;- Working

            with $oChart.SeriesCollection($j)
                .Name = $aChartSeriesName[$j] ;- Working
                .Values = $aChartSeriesRng[$j] ;- Not Working
                .XValues = $aChartSeriesRng[0] ;- Not Working
            EndWith

        Next

The $aChartSeriesRng variant in an array filled with Range objects (which is working in VB) and seems to work in AutoIt also cause I can MsgBox(0,"",$aChartSeriesRng[$j].Address)

I've been searching all around the forum to find how to tell Autoit to assign the XValues and Values to a series and I did not find nothing about it. Ime wondering why the .Name is working and not .XValues or .Values

Usually AutoIt syntax for Excel is pretty near than VBA Syntax

Thanks very much for your help!

Link to comment
Share on other sites

Add a COM error handler (see OBJ\COM Reference in the help file) and see if you get more detailed failure indications.

You might also do something like this to see if the object type is as expected:

ConsoleWrite("Debug: ObjName = " & ObjName($oChart.SeriesCollection($j)) & @LF)

:blink:

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...