Question : Setting properties with MS Access 2002 MSGraph.Chart.8

Sometime setting the poorly documented properties within MSGraph.Chart.8 drives me nuts. I have a MSGraph Chart on a Access 2002 form and when the form comes up I would like the user to be able to click a command button and select either  a bar chart or a line chart.   Here's how I do it behind the form:
-----------------------------------------

Private Sub cmdBarChart_Click()
    With Me.dpmoGraph
        .ChartType = 51 'Bar Chart
    End With
End Sub

Private Sub cmdLineChart_Click()
    With Me.dpmoGraph
        .ChartType = xl3DLine
    End With
End Sub
-----------------------------------------
For the Line Chart I need to set the following properties:

Chart Object
    3-D View
         Elevation = 0
         Rotation = 0
         Perspective = 0
         Auto Scaling = True
         Right Angle Aces = True

Chart Options
   Axes
       Series(Y) Axis = False

Let me tell you this is no fun trying to track down the properties and to put them in the correct syntax.
Any helpful working examples would be appreciated.

Thank you

Ted


Answer : Setting properties with MS Access 2002 MSGraph.Chart.8

I won't give you an example, but I will tell you how to get one.

Open Excel, start the macro recorder (record in the same workbook) and do whatever you need to do with charts. Close the recording and read the macro just created.

You will find that Excel Charts have the exact same object model as MS Graph. It is rather easy to adjust the recorded actions for it.

Another trick: Add a reference to the MS Graph object library. Then program like this:

    Dim grfSales As Graph.Chart

    Set grfSales = Me.dpmoGraph.Object
    With grfSales
        .    <--- ! great, the list of properties appears, i.e. Ctrl+J feature !

This should also be a big help (along with all those xlABCD constants now usable in your code).

Good Luck!
(°v°)
Random Solutions  
 
programming4us programming4us