|
-
Feb 2nd, 2005, 08:34 AM
#1
Thread Starter
Member
Power point already open
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
-
Feb 2nd, 2005, 09:10 AM
#2
Re: Power point already open
i would believe that if power point is already open the only change you would have to make is
Set ppObject = New PowerPoint.Application
leave out
rgds pete
-
Feb 2nd, 2005, 09:10 AM
#3
-
Feb 2nd, 2005, 09:12 AM
#4
-
Feb 2nd, 2005, 09:28 AM
#5
Re: Power point already open
change if from "new"?
Set ppObject = PowerPoint.Application
or does it even matter if it is already open?
p.
-
Feb 2nd, 2005, 09:33 AM
#6
-
Feb 2nd, 2005, 09:45 AM
#7
Thread Starter
Member
Re: Power point already open[RESOLVED]
cheers for that, worked by removing the line
VB Code:
ppObject.Presentations.Add
Thanks
-
Feb 3rd, 2005, 07:32 AM
#8
Re: Power point already open[RESOLVED]
 Originally Posted by wallacej
cheers for that, worked by removing the line
VB Code:
ppObject.Presentations.Add
Thanks
You're welcome. Just to point out that if PowerPoint isn't open though, it will cause an error
Has someone helped you? Then you can Rate their helpful post. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|