PDA

View Full Version : [SOLVED:] Merge selected files previewed into one file



RayKay
07-11-2019, 08:00 AM
Hi John :hi:

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 :thumb

John Wilson
07-13-2019, 07:30 AM
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

RayKay
07-15-2019, 02:50 AM
Thanks John, I'm having difficulty at the first hurdle :banghead:, 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.

John Wilson
07-15-2019, 05:32 AM
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

24596

RayKay
07-15-2019, 07:06 AM
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 :clap:

John Wilson
07-16-2019, 02:10 AM
Try changing

Set opres = Presentations.Add

TO

Set opres=ActivePresentation

make sure you have a blank pres based on your template open

RayKay
07-16-2019, 02:22 AM
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!

RayKay
07-16-2019, 07:50 AM
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 :)