I have a PPT containing say 25 slides and i would like to split the each slide into seperate file and later after some activites i will be merging the spliited files to one ppt.
Can you please help me in splitting and merging the ppt?
' Variables
Dim pptApp As Application = New Application()
Dim presentation As Presentation = pptApp.Presentations.Open("C:\path\to\your\presentation.pptx")
Dim slideIndex As Integer = 1
For Each slide As Slide In presentation.Slides
' Create a new presentation for each slide
Dim newPresentation As Presentation = pptApp.Presentations.Add()
slide.Copy()
newPresentation.Slides.Paste(1)
' Save the new presentation
Dim newFilePath As String = Path.Combine("C:\path\to\output\folder", "Slide_" & slideIndex & ".pptx")
newPresentation.SaveAs(newFilePath)
newPresentation.Close()
slideIndex += 1
Next
' Close the original presentation
presentation.Close()
pptApp.Quit()
Make sure you UiPath.Presentation.Activities dependency installed and GO to Imports Panel and Import Microsoft.Office.Interop.PowerPoint.
I m able to run the script now but there seems to be some issue. its not spliiting or merging as per the requirement.
As its not looping properly.
As i want to split all the slides from a ppt to a certain folder and the split folder should be 1slide 2slide 3slide etc. and this should be a file i.e ppt