Hello, I have a PowerPoint presentation that includes named slides and shapes. I would like to view and/or print the presentation with each slide and shape name visible. I have code that creates a .txt file with the slide number, slide name, and shape name for each shape on each slide (code below & .txt file output attached).
I have thought that a solution could be to loop through each slide and each shape and "print" the names to the Notes section of the corresponding slide and/or copy/paste the information into the Notes of the correct slide from the .txt file or from .xlsx file containing info from the .txt file.
- I have been able to add a text box to the Notes with slide number and slide name. I have not been able to loop through each shape on the slide and include each shape's name in the note (code below).
Preferable to that would be to identify the slide and each shape on that side by showing each object's border in conjunction with its name.
Any guidance/solutions would be appreciated. Thank you.
Below code is used to create .txt file with slide number, slide name, and shape names.
Sub PPTSlideNames()
'creates text file with all slide names and shape names
FileHandle = FreeFile
Open "PathOfFile.NameOfFile.txt" For Output As FileHandle
Print #FileHandle, Application.ActivePresentation.Name
Print #FileHandle, " "
Dim x As Long
For x = 1 To ActivePresentation.Slides.Count
Print #FileHandle, ActivePresentation.Slides(x).SlideNumber, ActivePresentation.Slides(x).Name
With ActivePresentation.Slides(x)
Dim y As Long
For y = 1 To .Shapes.Count
Print #FileHandle, .SlideNumber, .Shapes(y).Name
Next y
End With
Print #FileHandle, " "
Next x
Close #FileHandle
End Sub
Below code creates a text box with slide number and slide name in Notes of slide.
Sub PPTInfoFiletoNote()
Dim x As Long
For x = 1 To ActivePresentation.Slides.Count
Dim oDestSlide As PowerPoint.Slide
Set oDestSlide = ActivePresentation.Slides(x)
Dim SlideInfo As String
SlideInfo = oDestSlide.SlideNumber
SlideInfo = SlideInfo & " " & oDestSlide.Name
Dim oTextBox As PowerPoint.Shape
Set oTextBox = oDestSlide.NotesPage.Shapes.AddTextbox(msoTextOrientationHorizontal, Left:=58, Top:=359, Width:=461, Height:=340)
oTextBox.TextFrame.TextRange.Text = SlideInfo
Next x
End Sub
Thank you!
Bookmarks