Consulting

Results 1 to 8 of 8

Thread: Merge selected files previewed into one file

  1. #1
    VBAX Contributor
    Joined
    Dec 2018
    Location
    South London
    Posts
    115
    Location

    Merge selected files previewed into one file

    Hi John

    You've been magical in the past for helping me, truly grateful, and I've learned so much VBA, thank you.

    However, I'm stumped on this, it's similar to Reuse Slides, I have searched this great site:

    I have one folder containing 50+ PPTX files - ONE slide per file

    The 'macro' opens a specific path to these 50+ slides with a preview of each file (rather like a file manager)

    The user clicks several random slides and with another click of a button, these are merged into ONE new PPTX file


    • Preferably in the order they were clicked on?


    Many thanks

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    You will have to work on this but here's a starting point

    Sub merge_em()
    Dim L As Long
    Dim opres As Presentation
    Dim fd As FileDialog
    Set opres = Presentations.Add
    Set fd = Application.FileDialog(msoFileDialogOpen)
    With fd
    ' change to point to your folder
    ' you may need to chasnge the vioew type to large icons
    .InitialFileName = Environ("USERPROFILE") & "\Desktop\TP Docs"
    .ButtonName = "Merge"
    .AllowMultiSelect = True
    .Filters.Clear
    .Filters.Add "Presentations", "*.pptx"
    If .Show = True Then
    If .SelectedItems.Count > 0 Then
    For L = 1 To .SelectedItems.Count
    Call opres.Slides.InsertFromFile(.SelectedItems(L), opres.Slides.Count)
    Next L
    End If
    End If
    End With
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Contributor
    Joined
    Dec 2018
    Location
    South London
    Posts
    115
    Location
    Thanks John, I'm having difficulty at the first hurdle , where to put the file path for C:\ARCHIVE\Training

    Also, changing to Extra Large icons no slides are previewed, just one same icon for all files.

    Many thanks in advance for helping.

    With fd
    ' change to point to your folder
    ' you may need to chasnge the vioew type to large icons
    .InitialFileName = Environ("USERPROFILE") & "\Desktop\TP Docs"

    Alternatively, is there a way to open a Slide Library that shows all slides from the 50 files, so you can select what slides you want?
    Or Reuse Slides feature, but to show 50+ files rather than just the one file in Reuse Slides?

    Thank you. Hope I make sense.

    Last edited by RayKay; 07-15-2019 at 03:56 AM. Reason: New idea

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Your file path goes here
    .InitialFileName="C:\ARCHIVE\Training

    If swapping to large icons did not give a preview you probably did not save a preview image

    preview.jpg
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    VBAX Contributor
    Joined
    Dec 2018
    Location
    South London
    Posts
    115
    Location
    Hi John, all almost fine now, thanks. I discovered why slide previews failed. I must open ONE file from the same folder of 50+ files before running the VBA, previews are perfect. When I click slides I need, a brand new file is created ready to save (the ONE file open isn't affected).

    However, I lose the Slide Master / Layouts / Colours, it uses PPT's default.

    If I have my Template open, then run the VBA, can the new file use my Slide Masters / Colours?

    Thank you for your time and skills, you've helping me and so many people reading this

  6. #6
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Try changing

    Set opres = Presentations.Add

    TO

    Set opres=ActivePresentation

    make sure you have a blank pres based on your template open
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  7. #7
    VBAX Contributor
    Joined
    Dec 2018
    Location
    South London
    Posts
    115
    Location
    Hi John

    You are a miracle worker! Thank you!!
    I spent hours surfing for an answer, and no luck. THANK YOU!!!
    Will donate, thank you!

  8. #8
    VBAX Contributor
    Joined
    Dec 2018
    Location
    South London
    Posts
    115
    Location
    Hi John

    Before closing as solved, is there a way for it to work with SharePoint?
    I put the SharePoint path in, but it doesn't preview slides, and the browse button disappears.

    I've a feeling SharePoint won't preview within PowerPoint, only within SharePoint?

    Thank you

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
  •