PDA

View Full Version : Insert Slides from other presentation



bwells
05-29-2006, 08:22 AM
Is there a way to insert slide from one presentation into another with VBA? I have a add in where user can create take 5 slides from a presentation of lets say 100 and make a new presentation with only those 5. Lets say now i wanted to add in 3 from another presenation. Is there any type of vba code that can help me do that?

lucas
05-29-2006, 09:37 AM
This copies a slide from a closed workbook to the active one....
Sub Macro1()
Presentations.Open FileName:="F:\Temp\1.ppt", ReadOnly:=msoFalse
ActivePresentation.Slides(1).Copy
With Application.Presentations("1.ppt")
.Saved = True
.Close
End With
ActiveWindow.View.Paste
End Sub

bwells
05-29-2006, 09:46 AM
Nice, thanks. One thing that I did was invoke the menu option Insert>Slides from Files and let the user work with that.

Another question: Does anyone know how to access the browse button or funciton? For example in the islides from file men screen there is a browse button that allows you to pick a presentation but not open it right away. The file path is then shown in a text box. How can I access that operation

lucas
05-29-2006, 09:59 AM
from the help files:

Sub ShowFileDialog()
Dim dlgOpen As FileDialog
Set dlgOpen = Application.FileDialog( _
Type:=msoFileDialogOpen)
With dlgOpen
.AllowMultiSelect = True
.Show
End With
End Sub

bwells
05-30-2006, 05:54 AM
nice..Am I able to pull the fie path of the file they choose to a text box? Sorta like how the browse works.