PC Review


Reply
Thread Tools Rate Thread

Change MSGraph Axis Range in VBA

 
 
Alex Osbaldeston
Guest
Posts: n/a
 
      26th Nov 2003
Hi,

The query is basically as per the subject line. How do I use VBA code
to alter the y axis range of an MSGraph Chart. The Chart shape is
called "Chart". All I want to do is make the y axis go from 0 to 1.2.
I don't care about the major units and minor units as the axis is not
actually displayed. Which brings me onto...
As the axis is not actually shown in the chart, I don't know whether
the code would need to first show the axis, then change it, then set
the axis to not be shown (as one would have to do if you were doing it
manually)???
I'd be very grateful if someone could help here as I have 95
presentations each with 6 charts that need changing so I'm going to be
still doing it this time next week if I can't write a macro!

Many thanks
Alex
 
Reply With Quote
 
 
 
 
Andy Pope
Guest
Posts: n/a
 
      27th Nov 2003
Hi Alex,

Try this code sample, watch for line wrapping.

Sub SetYAxis()
Dim objGraph As Graph.Application
Dim objChart As Graph.Chart

Set objGraph = ActivePresentation.Slides(1).Shapes("Chart
1").OLEFormat.Object.Application
Set objChart = objGraph.Chart
With objChart
.HasAxis(2, 1) = True
With .Axes(2, 1)
.MaximumScale = 1.2
.MinimumScale = 0
End With
.HasAxis(2, 1) = False
End With
objGraph.Update
objGraph.Quit

Set objChart = Nothing
Set objGraph = Nothing
End Sub


Alex Osbaldeston wrote:

> Hi,
>
> The query is basically as per the subject line. How do I use VBA code
> to alter the y axis range of an MSGraph Chart. The Chart shape is
> called "Chart". All I want to do is make the y axis go from 0 to 1.2.
> I don't care about the major units and minor units as the axis is not
> actually displayed. Which brings me onto...
> As the axis is not actually shown in the chart, I don't know whether
> the code would need to first show the axis, then change it, then set
> the axis to not be shown (as one would have to do if you were doing it
> manually)???
> I'd be very grateful if someone could help here as I have 95
> presentations each with 6 charts that need changing so I'm going to be
> still doing it this time next week if I can't write a macro!
>
> Many thanks
> Alex


--

Cheers
Andy

http://www.andypope.info

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to change x-axis date range jschultzbass Microsoft Excel Charting 5 30th Jun 2009 10:23 AM
Programmatically changing MSGraph Y axis label and values off =?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?= Microsoft Powerpoint 2 29th Jun 2007 04:36 PM
How to change y axis automatic time range? =?Utf-8?B?bWlrZQ==?= Microsoft Excel Charting 1 21st Sep 2006 07:06 PM
MSGraph: Setting X-Axis Major Unit Values Alan Z. Scharf Microsoft Access Reports 2 11th Apr 2006 04:12 PM
MSGraph 2000 Add Z Axis AlCamp Microsoft Access Reports 1 4th Dec 2004 02:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:44 PM.