Consulting

Results 1 to 5 of 5

Thread: Custom slide show filter for slide sorter view

  1. #1
    VBAX Newbie
    Joined
    Aug 2021
    Posts
    3
    Location

    Custom slide show filter for slide sorter view

    Please help me....I have a few custom slide shows and wanted to use that as a filter to view these slides in slide sorter mode?

    would slide tags work and how?

    I found the vba in the attached txt file that will identify the slide ID's and although it works fine it seems not the best way to reference by ID's
    Attached Files Attached Files

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    Attaching a presentation PPTM as an example would make it easier to see what you want
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Custom Shows are always referenced by ID as this allows the slides to be moved without breaking the custom show.

    It is posssible to show the current slide index but this will be unreliable if you reorganise the presentation in any way.

    Sub GetListofCustomShows(ByVal Pres As Presentation, _    
    ByRef CustomShows As Collection)
    
        Dim NS As NamedSlideShow
    
        Dim I As Long
        Dim S As String
        Dim osld As Slide
    
        With Pres.SlideShowSettings
        
            For Each NS In .NamedSlideShows
                S = NS.Name + ": "
                For I = 1 To NS.Count
                Set osld = Pres.Slides.FindBySlideID(NS.SlideIDs(I))
                    S = S & CStr(osld.SlideIndex) & ", "
                Next
                S = Left(S, Len(S) - 2)
                CustomShows.Add S
            Next
        End With
    End Sub
    
    
    
    
    
    
    Sub Test()
        Dim Msg As String
        Dim CustomShows As Collection
        Dim I As Long
    
    
        Set CustomShows = New Collection
        GetListofCustomShows ActivePresentation, CustomShows
        For I = 1 To CustomShows.Count
            Msg = Msg + CustomShows(I) + vbCrLf
        Next
        MsgBox Msg, vbInformation Or vbOKOnly, "Custom Shows List"
    
    
        Set CustomShows = Nothing
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  4. #4
    VBAX Newbie
    Joined
    Aug 2021
    Posts
    3
    Location
    Many thanks for the info that I will check out.

    Are there any good references or tutorials as to how tags really work...after a bit of experimentation I realised that tags is just a JSON pair so I could have multiple tags with the tag name & also the value as unique to do some really powerfull stuff. The std powerpoint methods to manage slides is just so lacking and poor....if the custom slide show could filter the slides on the slide sorter view it would be so great (oh yeah and create a new presentation from the custom slide shows) but MS never really ask their users do they.

    Looking into the tags it seems a very powerfull method so I am trying to learn more about it so please let me know if you know of any good in depth articles.

    Below is what I got working well now:

    Sub SetTheTagToSelectedSlides()
    Dim osld As Slide
    Dim sTagName As String
    Dim sTagValue As String
    Dim TagValueToSlides As Variant


    'change to suit
    sTagName = InputBox("Enter slide tag name")
    TagValueToSlides = InputBox("Enter slide tag value")


    'check for selection
    If ActiveWindow.Selection.Type = ppSelectionNone Then GoTo errhandler


    'add tags
    For Each osld In ActiveWindow.Selection.SlideRange
    osld.Tags.Add sTagName, TagValueToSlides
    Next osld
    Exit Sub
    errhandler:
    MsgBox "You need to select slides first!"
    End Sub


    Sub ExtractSlidesWithTags()
    Dim TagNameToSlides As String
    Dim TagValueToSlides As String
    Dim AnythingFound As Boolean
    Dim currentPresentation As Presentation
    Dim newPresentation As Presentation
    Dim s As Slide


    TagNameToSlides = InputBox("Tag name of slides to extract")
    TagValueToSlides = InputBox("Tag Value of slides to extract")


    ' Save reference to current presentation
    Set currentPresentation = Application.ActivePresentation


    ' Save reference to current slide
    'Set currentSlide = Application.ActiveWindow.View.Slide


    ' Add new Presentation and save to a reference
    Set newPresentation = Application.Presentations.Add


    ' Add the current slide master
    'ActivePresentation.Designs.Load "G:\Cloud\CATIM\CATIM SharePoint - Documents\Admin\Templates\Documents\CATIM org wide v7.potx"
    ActivePresentation.ApplyTemplate "G:\Cloud\CATIM\CATIM SharePoint - Documents\Admin\Templates\Documents\CATIM org wide v7.potx"




    For Each Slide In currentPresentation.Slides
    If Slide.Tags(TagNameToSlides) = TagValueToSlides Then
    Slide.Copy
    ' Paste it in new Presentation
    newPresentation.Slides.Paste
    AnythingFound = True
    Wait (1)
    End If
    Next




    If AnythingFound = True Then
    newPresentation.SaveAs (currentPresentation.Path & "" & TagNameToSlides & "_Extract.pptm")
    Else
    MsgBox "No slides have that tag named"
    End If


    End Sub


    Public Sub Wait(Seconds As Double)
    Dim endtime As Double
    endtime = DateTime.Timer + Seconds
    Do
    WaitMessage
    DoEvents
    Loop While DateTime.Timer < endtime
    End Sub






    Sub SlideMasterCleanup()
    Dim i As Integer
    Dim j As Integer
    Dim oPres As Presentation
    Set oPres = ActivePresentation
    On Error Resume Next
    With oPres
    For i = 1 To .Designs.Count
    For j = .Designs(i).SlideMaster.CustomLayouts.Count To 1 Step -1
    .Designs(i).SlideMaster.CustomLayouts(j).Delete
    Next
    Next i
    End With


    End Sub
    Last edited by thecatim; 08-05-2021 at 03:38 PM.

  5. #5
    VBAX Newbie
    Joined
    Aug 2021
    Posts
    3
    Location
    One last thing...I managed to get the slides extracted and saved with what I required accept it is not copying the slide background graphic that is really odd. I have seen that one can add by VBA the background from a folder etc however I just really want the slide completely as is with all content, styling and background. There seems no info on copying the background over on google?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •