Search and merge powerpoint

Kirill_Temchuk

New Member
Joined
Jan 3, 2017
Messages
1
Hello,

I am super new to VBA, and already got stuck in completing one task. So if it is possible, please help me out with this one.

The idea is to merge all one-slider ppt presentations (all are in one folder) for corresponding person listed in the excel file. The challenge for me is that there is no strict ppt file name listed in excel worksheet only the name, id and e-mail for each person (e.g name listed in excel: "Iron Man", one-slider name for this person is: "Riga Marvel Iron Man.ppt").

So far I found a solution to merge ppt slide listed in excel if the value in the cell is 100% match to the ppt file name.

This is the example of excel table:

Nr.NameE-mailID
1Iron Maniron.man@something.comiron.man
2Spider Manspider.man@something.comspider.man
3Wonder Womanwonder.woman@something.comwonder.woman
4Green Lanterngreen.lantern@something.comgreen.lantern
5Luke Cageluke.cage@something.comluke.cage

<tbody>
</tbody>

Those are ppt files name:


Riga Marvel Wonder Woman.ppt
Riga Marvel Iron Man.ppt
Riga Marvel Green Lantern.ppt
Riga Marvel Spider Man.ppt
Riga Marvel Luke Cage.ppt

This is my code on the moment:

Sub Procedure1()

Dim objPowerPoint As Object
Dim objTemplate As Object
Set objPowerPoint = CreateObject(Class:="PowerPoint.Application")

'setting up the path to powerpoit template
Const strTemplatePath As String = "C:\Users\kirills.temcuks\Desktop\for macros\TEMPLATE.ppt"

'setting "save as" path.
Const strSaveAs As String = "C:\Users\kirills.temcuks\Desktop\TEMPLATE.ppt"

'setting path with "one-sliders.
Const strWorkFolder As String = "C:\Users\kirills.temcuks\Desktop\for macros"
Dim i As Long

'setting up the objTemplate var
Set objTemplate = objPowerPoint.Presentations.Open(fileName:=strTemplatePath)

'"saving as" ppt-template.
objTemplate.SaveAs fileName:=strSaveAs

'adding ppts marked with + in excel to the template.
'searching troug the rows from 2 to 6.
For i = 2 To 10 Step 1
If Cells(i, "B").Value <> "" Then
objTemplate.Slides.InsertFromFile fileName:=strWorkFolder & Cells(i, "B").Value, Index:=objTemplate.Slides.Count
End If
Next i
'complition message.
MsgBox "PPT completed", vbInformation
End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,191,693
Messages
5,988,135
Members
440,127
Latest member
naxmax

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top