W
Wayne Cressman
I've built the following function to create graphs (based on other
functions I've seen online):
Public Function AddChartObject(objWs As Worksheet, intLeft As Integer, _
intTop As Integer, intWidth As Integer, intHeight As Integer, _
xlChartType As xlChartType) As ChartObject
Dim objChart As ChartObject
Set objChart = objWs.ChartObjects.Add(Left:=intLeft,
Width:=intWidth, Top:=intTop, Height:=intHeight)
objChart.Chart.ChartType = xlChartType
Set AddChartObject = objChart
End Function
Which I'm calling like such:
Set objChart = AddChartObject(objWs, 20, 156, 400, 252, xl3DBarStacked)
In the latter 'xl3DBarStacked' is the XLGraphType which gives me
horizontal bars in the graph. But what if I want vertical bars, what's
the constant for that.
Also, if I browse the list of XLGraphType's in the object browser, how
do I work out what kind of graph is generated without individually
trying out each constant in my AddChartObject function?
Thanks,
Wayne C.
functions I've seen online):
Public Function AddChartObject(objWs As Worksheet, intLeft As Integer, _
intTop As Integer, intWidth As Integer, intHeight As Integer, _
xlChartType As xlChartType) As ChartObject
Dim objChart As ChartObject
Set objChart = objWs.ChartObjects.Add(Left:=intLeft,
Width:=intWidth, Top:=intTop, Height:=intHeight)
objChart.Chart.ChartType = xlChartType
Set AddChartObject = objChart
End Function
Which I'm calling like such:
Set objChart = AddChartObject(objWs, 20, 156, 400, 252, xl3DBarStacked)
In the latter 'xl3DBarStacked' is the XLGraphType which gives me
horizontal bars in the graph. But what if I want vertical bars, what's
the constant for that.
Also, if I browse the list of XLGraphType's in the object browser, how
do I work out what kind of graph is generated without individually
trying out each constant in my AddChartObject function?
Thanks,
Wayne C.