Log in

View Full Version : Indexing as "other" Presentation that is open



mmm206
12-12-2016, 01:23 PM
Hello I am Trying to automate a PowerPoint presentation form that is used by first sending a survey, Writing the code on the ppt to be populated with the desired text. Is it possible to make the code not care what the name of the other Presentation is? I want to do it this way so that it doesn't matter if the title has been saved as something else by whoever was filling it out. Here is the code I have so far. Is what I am asking possible or must it be defined. The presentation I want to pull from is highlighted blue.

Dim PP As PowerPoint.Application
Dim PPPres1 As PowerPoint.Presentation
Dim PPPres2 As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim workshoptitle As Shape
Dim workshoptitle1 As Shape
Set PPPres1 = PowerPoint.Presentations("MV014_pfs.pptm")
Set PPPres2 = PowerPoint.Presentations("MV014Survey.pptx")

With PPPres1 ' finding if shape exists
On Error Resume Next
If .Slides(1).Shapes("workshoptitle1") Is Nothing Then
On Error GoTo 0
With ActivePresentation.Slides(1).Shapes.AddShape(msoShapeRectangle, 110, 42, 250, 25) ' Creating Shape
.Name = "workshoptitle1"
.TextFrame.TextRange.Font.Size = 12

End With
End If
.Slides(1).Shapes("workshoptitle1").TextFrame.TextRange.Text _
= PPPres2.Slides(1).Shapes("workshoptitle").TextFrame.TextRange.Text
End With

John Wilson
12-12-2016, 02:52 PM
One way could be to add a TAG to the presentation and then loop throgh open presentations to find it.

ActivePresentation.Tags.Add "SURVEY","YES"

Then


For x = 1 To Presentations.Count
If Presentations(x).Tags("SURVEY") = "YES" Then 'it's the one
Next x