hello all,
I'm trying to copy specific slides in a PPT file to a new PPT file without much luck,
does anyone know how to copy a slide to a new file ( or even to memory so I can build a large array first.)?
This isn't much to go on, but a start.
Any help or pointers would be greatly appreciated!
Thanks
D
I'm trying to copy specific slides in a PPT file to a new PPT file without much luck,
does anyone know how to copy a slide to a new file ( or even to memory so I can build a large array first.)?
This isn't much to go on, but a start.
Code:
' open original file
Dim appPP As Microsoft.Office.Interop.PowerPoint.Application
Dim appPP2 As Microsoft.Office.Interop.PowerPoint.Application
Dim book As Microsoft.Office.Interop.PowerPoint.Presentation
Dim slide As Microsoft.Office.Interop.PowerPoint.Slides
Dim picture As Microsoft.Office.Interop.PowerPoint.SlideRange
Dim path As String = ""
Dim path2 As String = ""
appPP = New Microsoft.Office.Interop.PowerPoint.Application
appPP.Activate()
appPP.NewPresentation.Add(1, , )
path = "e:\samplefile1.ppt"
' open new file.
appPP2 = New Microsoft.Office.Interop.PowerPoint.Application
appPP2.Activate()
appPP2.NewPresentation.Add(1, , )
path2 = "e:\blank.ppt"
appPP.Presentations.Open(path, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTriStateToggle)
appPP.WindowState = PpWindowState.ppWindowMinimized
appPP2.Presentations.Open(path2, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue)
' just messing about- writing content to new file.
Dim slideCount As Integer = appPP.ActivePresentation.Slides.Count
Label1.Text = "Slides: " & slideCount
Dim layout As Microsoft.Office.Interop.PowerPoint.CustomLayout
layout = appPP.ActivePresentation.SlideMaster.CustomLayouts(Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutTitle)
layout.Shapes.Title.TextFrame.TextRange.Text = "DDH some content DDH"
appPP2.ActivePresentation.Slides.AddSlide(q, layout)
' loop through slides in original file - and copy??
For q As Integer = 1 To slideCount
' appPP.ActivePresentation.Slides.Item(q).Copy()
Next
' close down original file.
appPP.ActivePresentation.Close()
appPP.Windows.Application.Quit()Any help or pointers would be greatly appreciated!
Thanks
D









