excel - Creating VBA Chart using Array -


i trying create excel chart using vb6. instead of feeding excel range im trying feed array. , im getting error. code im working on

private sub createchart(optional byval charttitle string _                 , optional byval xaxis excel.range _                 , optional byval yaxis excel.range _                 , optional byval columnname string _                 , optional byval legendposition xllegendposition = xllegendpositionright _                 , optional byval rowindex long = 2 _                 , optional byref charttype string = xllinemarkers _                 , optional byval plotareacolorindex long = 2 _                 , optional byval issetlegend boolean = false _                 , optional byval issetlegendstyle boolean = false _                 , optional byval legendstylevalue long = 1)  const constchartleft = 64 const constchartheight = 300 const constchartwidth = 700  dim xlchart excel.chartobject dim seriescount long dim colorindex long  dim j long   mworksheet     .rows(rowindex).rowheight = constchartheight      set xlchart = .chartobjects.add(.rows(rowindex).left, .rows(2).top, constchartwidth, constchartheight) end  xlchart.chart     .charttype = charttype     .setsourcedata source:=marraypoclient, plotby:=marrayposku     .seriescollection(1).xvalues = marraypoclient     .hastitle = true      .legend.position = legendposition     .legend.font.size = 7.3     .legend.font.bold = true     .legend.border.linestyle = xlnone      .charttitle.characters.text = charttitle     .charttitle.font.bold = true      .axes(xlvalue).ticklabels.font.size = 8 ' yaxis labels     .axes(xlcategory).ticklabels.font.size = 8 ' xaxis labels      .plotarea.interior.colorindex = plotareacolorindex     .plotarea.interior.colorindex = 15     .plotarea.interior.patterncolorindex = 1     .plotarea.interior.pattern = xlsolid end end sub 

is possible use array chart. if possible mistakes.

as mat's mug says, setsourcedata requires range, can achieve result using method

replace

.setsourcedata source:=marraypoclient, plotby:=marrayposku 

with

.seriescollection.newseries .seriescollection(1).values = marraypoclient 

this create new series without source, assign array series values


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -