Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Chart from Access VBA

Status
Not open for further replies.

aldi07

MIS
Jun 22, 2010
100
CA
Hi,
I am creating a chart in excel 2007 from access VBA 2007. It works very well. The only point I could not program, is changing the Axis Title color. I tried:

With appExcel
.ActiveChart.Axes(xlCategory).AxisTitle.Font.Color = vbCyan
End With

and I get "Object doesn't support this property or method"

Any clues anyone? thank you in advance.
 
Hi dhookom,
Actually yes, I did. It just ignores the action, and does not reproduce it into VBA code.
For example if I select the y axis title, and changes it's font to red, this is what the recorded macro shows in excel:
Sub Macro2()
'
' Macro2 Macro
'

'
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlValue).AxisTitle.Select
ActiveSheet.ChartObjects("Chart 1").Activate
End Sub
 
This worked for me:
Code:
Sub SetYAxisColor()
    Dim myChart As Chart
    Dim ax As Axis
    Set myChart = ThisWorkbook.Worksheets(2).ChartObjects(1).Chart
    Set ax = myChart.Axes(xlCategory)
    With ax
        .AxisTitle.Font.Color = vbCyan
    End With
End Sub

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top