VBA to add objects to PPT?

N

nimmis

I have this code that adds an image to a PPT slide. Does anyone out there
know how to modify the code to add Objects into the slide?

I tried this:

Set oPicture =
..AddOLEObject("K:nimmi\sage\reports\GeographicAnalysisByStateChart.snp", _
msoFalse, msoTrue, 0, 0, 1, 1)

and I get Run-time error '13' Type mismatch.

Can someone out there help???

Dim oPPTApp As PowerPoint.Application
Dim oPPTPres As PowerPoint.Presentation
Dim oPPTShape As PowerPoint.Shape
Dim oPPTCurrentSlide As PowerPoint.Slide
Dim sPresentationFile As String

sPresentationFile = "K:\nimmi\sage\reports\MAS.PPT"

Set oPPTApp = New PowerPoint.Application
oPPTApp.Visible = True
oPPTApp.WindowState = ppWindowMinimized

Set oPPTPres = oPPTApp.Presentations.Open(sPresentationFile)
Set oPPTCurrentSlide = oPPTPres.Slides.Add(Index:=1, _
Layout:=ppLayoutBlank)


With oPPTCurrentSlide.Shapes
' Adds a picture to slide 1 in the active presentation.
Set oPicture = .AddPicture("c:\somefile.snp", _
msoFalse, msoTrue, 0, 0, 1, 1)
' Now scale the image
oPicture.ScaleHeight 1, msoTrue
oPicture.ScaleWidth 1, msoTrue

End With
End Function
 
M

maryomaga3

i am new in here and i need help bring my powerpoint up,can any one help me
with this.thank you mary
 

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