Programmatically changing MSGraph Y axis label and values off

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'd like to programmatically clear the Y axis label for an MSGraph if the
title contains specific information. I've just not been able to find the
code to identify the Y axis label and the Y axis values and i"m not sure I
have the title either. Can someone assist? This is what I have so far.

For Each myShape In mySlide.Shapes
If myShape.Type = 7 Then
With myShape
If .OLEFormat.ProgID = "MSGraph.Chart.8" Then
Set objMSGraph = .OLEFormat.Object
If objMSGraph.HasTitle Then
With objMSGraph.Application
'I think I can get the info I need here, but
what is it?
'If the title = something then
'turn off the values displayed on the
y axis
'We want to show a graph with no Y
labels as the data is company sensitive
End if

End With
End If
End If
End With
End If
Next myShape

Thanks,
Barb Reinhardt
 
Hi,

Something like this. Watch for line wrapping.

Sub X()

Dim myShape As Shape
Dim objMSGraph As Object
Dim mySlide As Slide

Set mySlide = ActivePresentation.Slides(1)

For Each myShape In mySlide.Shapes
If myShape.Type = 7 Then
With myShape
If .OLEFormat.ProgID = "MSGraph.Chart.8" Then
Set objMSGraph = .OLEFormat.Object
With objMSGraph.Application
With .chart
If .HasTitle Then
' .axes(xlvalue).ticklabelposition
If .ChartTitle.Text = "Barb" Then
.axes(2).TickLabelPosition _
= -4142 'xlNone
Else
.axes(2).TickLabelPosition _
= -4134 'xlLow
End If
End If
End With
.Update
.Quit
End With
End If
End With
End If
Next myShape

End Sub

Cheers
Andy
 
Thanks Andy. That did it.

Andy Pope said:
Hi,

Something like this. Watch for line wrapping.

Sub X()

Dim myShape As Shape
Dim objMSGraph As Object
Dim mySlide As Slide

Set mySlide = ActivePresentation.Slides(1)

For Each myShape In mySlide.Shapes
If myShape.Type = 7 Then
With myShape
If .OLEFormat.ProgID = "MSGraph.Chart.8" Then
Set objMSGraph = .OLEFormat.Object
With objMSGraph.Application
With .chart
If .HasTitle Then
' .axes(xlvalue).ticklabelposition
If .ChartTitle.Text = "Barb" Then
.axes(2).TickLabelPosition _
= -4142 'xlNone
Else
.axes(2).TickLabelPosition _
= -4134 'xlLow
End If
End If
End With
.Update
.Quit
End With
End If
End With
End If
Next myShape

End Sub

Cheers
Andy
 
Back
Top