Using excel vba to produce a powerpoint slide

K

KDUT

Hi,

I am writing a vba program to open powerpoint and produce
a new slide based on a column chart with data labels - I
have amanged to open powerpoint and insert a new slide of
the right type, however I cannot access the chart on the
page to change the chart options etc as well as getting to
the data sheet behind it. Has anyone got any ideas?

Please see the code that I have at the moment below

Many thanks

KDUT



' Change this to the auto layout you want to use. This
value can be
' any PpSlideLayout constant.
Const DEFAULT_AUTO_LAYOUT As Long = ppLayoutChart

' Get the number of slides in the active presentation.
lLastSlide = oPPTApp.ActivePresentation.Slides.Count
lLastSlide = lLastSlide + 1
oPPTApp.ActivePresentation.Slides.Add lLastSlide,
DEFAULT_AUTO_LAYOUT


Dim oPPTShape As PowerPoint.Shape
Dim rngNewRange As Excel.Range
Dim oGraph As Object

With oPPTApp.ActivePresentation.Slides(lLastSlide)
With .Shapes(1)
With .TextFrame.TextRange
.Text = chart_title
.Font.Name = "Arial"
.Font.Size = 24
End With
End With
.........
 
M

Mike Waldron

Hi,

Yes, PowerPoint uses an application called MS Graph for
graphing. You will need to set a separate referrence to
MicroSoft Graph 9.0 library, or the highest version you
have. (from the IDE choose Tools, References). That will
give you access to the object model for MS Graph. You
need one set for Graph and one for PowerPoint. PowerPoint
alone isn't enough.

Query MS Graph on the MicroSoft web site. There are
several informative articles with code samples that will
help.

Mike
 

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