Programmatically changing MSGraph Y axis label and values off

B

Barb Reinhardt

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
 
A

Andy Pope

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
 
B

Barb Reinhardt

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top