Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-09-2020, 02:38 PM
noslenwerd noslenwerd is offline Name slides in PPT with VBA, or have an index? Windows 10 Name slides in PPT with VBA, or have an index? Office 2016 for Mac
Novice
Name slides in PPT with VBA, or have an index?
 
Join Date: Dec 2019
Posts: 15
noslenwerd is on a distinguished road
Default Name slides in PPT with VBA, or have an index?

Hello,

I am working with an excel document with about 100 marlett checkboxes, aka 100 topics. The back end of this process works with Word macros to deliver a write up to a customer based on the topics they select.

I would also like on the front end to develop a macro in excel, to work with a PPT library. See image below:



In this example I have a PPT with slides already created that correspond to the 10 options. I want to do one of two things:
Copy that master slide deck, and erase the slides not selected.


Open the master slide deck, copy the two options (Similar Web and Uber Suggest) into a new PPT presentation.

I know I can reference slide locations using integers, but can I somehow name slides? This becomes quite an administrative task once you talk about 100 different options.

Cross posted at Name slides in PPT with VBA, or have an index?
Reply With Quote
  #2  
Old 03-10-2020, 04:26 AM
JohnWilson JohnWilson is offline Name slides in PPT with VBA, or have an index? Windows 10 Name slides in PPT with VBA, or have an index? Office 2016
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,813
JohnWilson will become famous soon enoughJohnWilson will become famous soon enough
Default

You can name the selected slide easily
Code:
ActiveWindow.Selection.SlideRange(1).name="myName"
The names must be unique and you can refer to the slide with
Code:
ActivePresentation.Slides("myName")
__________________
Microsoft PowerPoint MVP
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 03-10-2020, 06:41 AM
noslenwerd noslenwerd is offline Name slides in PPT with VBA, or have an index? Windows 10 Name slides in PPT with VBA, or have an index? Office 2016 for Mac
Novice
Name slides in PPT with VBA, or have an index?
 
Join Date: Dec 2019
Posts: 15
noslenwerd is on a distinguished road
Default

Quote:
Originally Posted by JohnWilson View Post
You can name the selected slide easily
Code:
ActiveWindow.Selection.SlideRange(1).name="myName"
The names must be unique and you can refer to the slide with
Code:
ActivePresentation.Slides("myName")
Hi John,

Thank you for this. Great info.

Now what if I hand this project off to someone and they have no idea what I named my 100 slides. Is there code that will list the names of ALL slides? Or better yet all slides, and the index (position) of said slides?
Reply With Quote
  #4  
Old 03-10-2020, 07:53 AM
JohnWilson JohnWilson is offline Name slides in PPT with VBA, or have an index? Windows 10 Name slides in PPT with VBA, or have an index? Office 2016
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,813
JohnWilson will become famous soon enoughJohnWilson will become famous soon enough
Default

Try something based on this:

Code:
Sub readem()

Dim osld As Slide
Dim strReport As String
Dim inum As Integer
Dim strFileName
inum = FreeFile
strFileName = Environ("TEMP") & "\data.txt"
For Each osld In ActivePresentation.Slides
strReport = strReport & "Slide Index: " & osld.SlideIndex & vbTab _
& "Name: " & osld.Name & vbCrLf
Next osld
Open strFileName For Output As inum
    Print #inum, strReport
    Close inum
    Call Shell("NOTEPAD.EXE " & strFileName, vbNormalFocus)
End Sub
__________________
Microsoft PowerPoint MVP
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #5  
Old 03-10-2020, 01:58 PM
noslenwerd noslenwerd is offline Name slides in PPT with VBA, or have an index? Windows 10 Name slides in PPT with VBA, or have an index? Office 2016 for Mac
Novice
Name slides in PPT with VBA, or have an index?
 
Join Date: Dec 2019
Posts: 15
noslenwerd is on a distinguished road
Default

Quote:
Originally Posted by JohnWilson View Post
Try something based on this:

Code:
Sub readem()

Dim osld As Slide
Dim strReport As String
Dim inum As Integer
Dim strFileName
inum = FreeFile
strFileName = Environ("TEMP") & "\data.txt"
For Each osld In ActivePresentation.Slides
strReport = strReport & "Slide Index: " & osld.SlideIndex & vbTab _
& "Name: " & osld.Name & vbCrLf
Next osld
Open strFileName For Output As inum
    Print #inum, strReport
    Close inum
    Call Shell("NOTEPAD.EXE " & strFileName, vbNormalFocus)
End Sub
Absolutely brilliant!!!

Thank you so much.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can a I create an index in a word document where index entries control sections of the document? pfriorda Word 3 12-28-2017 08:02 PM
Get Paragraph index from bookmark starting index vince692 Word VBA 6 05-13-2016 04:51 AM
Name slides in PPT with VBA, or have an index? Pulling Specific Slides from a Deck to create new slides ColinW PowerPoint 2 07-17-2015 11:30 AM
Name slides in PPT with VBA, or have an index? Difference between Slides.addSlide and Slides.Add? tinfanide PowerPoint 3 12-29-2012 11:55 PM
Inserting slides between existing slides in 2003 watsonstudios PowerPoint 1 05-20-2011 08:15 PM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 03:35 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft