VBA to add objects to PPT?

  • Thread starter Thread starter nimmis
  • Start date Start date
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
 
i am new in here and i need help bring my powerpoint up,can any one help me
with this.thank you mary
 
Back
Top