A
Andrew Smith
It depends on exactly how much you need to control.
To just change the data, but keep all the chart settings constant, you can
just change the RowSource property of the object frame that holds the chart.
To get full control over the chart (eg chart type, display/ hide legend,
change colours etc) then you need to add a reference to the Microsoft Graph
Object library, and declare a module level graph object in the form that
contains the graph. In the load event of the form you can then instantiate
the object using code such as:
Set objGraph = Me.ctlChart.Object
(objGraph is the name of the graph object and ctlChart is the name of the
object frame).
You can then use vba to work with the various properties of the chart
object. The object model is described in the file vbagr10.chm (for version
10, Office XP).
To just change the data, but keep all the chart settings constant, you can
just change the RowSource property of the object frame that holds the chart.
To get full control over the chart (eg chart type, display/ hide legend,
change colours etc) then you need to add a reference to the Microsoft Graph
Object library, and declare a module level graph object in the form that
contains the graph. In the load event of the form you can then instantiate
the object using code such as:
Set objGraph = Me.ctlChart.Object
(objGraph is the name of the graph object and ctlChart is the name of the
object frame).
You can then use vba to work with the various properties of the chart
object. The object model is described in the file vbagr10.chm (for version
10, Office XP).