Merging Powerpoint Files

Hi guys,

I have more than one presentation files and i need to merge all of them specific locations in main presentation. so, how can i do that?

Thank you.

hi @Kuki_Force

Have you tried this way?

Regards
Sudharsan

1 Like

@Kuki_Force

Download this package
image

You will have copy paste slide activity in it

cheers

Hi,

Thanks for your help.

But i cannot use 3rd part activities.

Regards.

@Kuki_Force

Then you can use presentation activities which is UiPath owned

image

Regards
Sudharsan

1 Like

Hi @Kuki_Force
Try this Vb.net code to merge two powerpoint file.

’ Declare variables for the PowerPoint application and the source and destination files
Dim pptApp As PowerPoint.Application
Dim srcFile1 As String
Dim srcFile2 As String
Dim destFile As String

’ Set the file paths for the source and destination files
srcFile1 = “C:\Users\User\Desktop\File1.pptx”
srcFile2 = “C:\Users\User\Desktop\File2.pptx”
destFile = “C:\Users\User\Desktop\MergedFile.pptx”

’ Create an instance of the PowerPoint application
Set pptApp = New PowerPoint.Application

’ Open the destination file
Dim destPres As PowerPoint.Presentation
Set destPres = pptApp.Presentations.Open(destFile)

’ Open the first source file
Dim srcPres1 As PowerPoint.Presentation
Set srcPres1 = pptApp.Presentations.Open(srcFile1)

’ Insert the slides from the first source file into the destination file
For Each slide In srcPres1.Slides
destPres.Slides.InsertFromFile(srcFile1, slide.SlideIndex, 1, 1)
Next

’ Close the first source file
srcPres1.Close

’ Open the second source file
Dim srcPres2 As PowerPoint.Presentation
Set srcPres2 = pptApp.Presentations.Open(srcFile2)

’ Insert the slides from the second source file into the destination file
For Each slide In srcPres2.Slides
destPres.Slides.InsertFromFile(srcFile2, slide.SlideIndex, 1, 1)
Next

’ Close the second source file
srcPres2.Close

’ Save and close the destination file
destPres.Save
destPres.Close

’ Quit the PowerPoint application
pptApp.Quit

’ Release the object variables
Set destPres = Nothing
Set srcPres2 = Nothing
Set srcPres1 = Nothing
Set pptApp = Nothing

Hope it will works

1 Like

Hi thanks for your answer and help.

I wrote your code but it gives me an error.

What should i change or should do?

Thanks.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.