I have the following code which opens PowerPoint, creates a presentation, adds a slide and then inserts an image onto the slide:
VB Code:
Private Sub openPowerPoint() Dim ppObject As PowerPoint.Application Dim ppPres As PowerPoint.Presentation Dim picLocation As String 'Open and show PowerPoint Set ppObject = New PowerPoint.Application ppObject.Visible = True 'Add presentation to PowerPoint ppObject.Presentations.Add Set ppPres = ppObject.Presentations.Item(1) 'Add a blank slide to PowerPoint presentation ppPres.Slides.Add 1, ppLayoutBlank ppPres.Slides(1).Select 'Insert picture picLocation = txtToInsert.Text 'size needs to be decided ppPres.Slides(1).Shapes.AddPicture(FileName:=picLocation, LinkToFile:=False, SaveWithDocument:=True, Left:=0, Top:=0, Width:=170, Height:=230).Select End Sub
Can anybody help me to perform a similar task but with powerpoint already open?
The code would just have to create a new slide and then insert the image.
Thanks




Reply With Quote