Opening

Use the Open method to open a presentation and add it to the Presentations collection.


Application.Presentations.Open(FileName:="C:\Temp\Presentation1.ppt", _ 
                    ReadOnly:=Office.msoTriState.msoFalse)
                    Untitled:=Office.msoTriState.msoTrue)
                    WithWindow:=Office.msoTriState.msoTrue)

The WithWindow argument determines if the presentation will be made visible in a new window and whether it will appear on the taskbar.



Which of the open presentations are in "edit" mode, and which are running as a slide show:

 'Executed from a running slide show.
Dim Pres As Presentation, i As Integer
Dim PPsList As String, PPtList As String
 
'Since each slide show is a presentation but not every presentation a slide show,
'two loops are used, an outer loop which loops through the presentations collection,
'and a inner loop which loops only through the slide show windows collection.
For Each Pres In Presentations
    For i = 1 To SlideShowWindows.Count
'Compare the slide show name to presentation name(s),
'and if a match is found, skip to the next presentation.
        If SlideShowWindows(i).Presentation.Name = Pres.Name Then
'Create the collection of slide shows.
            PPsList = PPsList & Pres.Name & vbCrLf: Goto SkipPres
        End If
    Next i
'Create the collection of presentations.
    PPtList = PPtList & Pres.Name & vbCrLf
SkipPres:
Next Pres
 
'Display the result.
MsgBox "Running Slide show(s):" & vbCrLf & PPsList & vbCrLf & _
Presentation(s) in edit mode: & vbCrLf & PPtList

Whereas the Presentations.Open method will open a ppt file in "edit" mode, when we apply the same method to open a pps file, the file will always be opened as a slide show. This is the default behaviour of the "Open" method, but sometimes we might want/need to open a pps file in edit mode too.


Dim EditPres As Presentation 
 
'Open a pps file, but prevent it from running as a slide show by setting the WithWindow argument to False.
Set EditPres = Presentations.Open("C:\MyPresentation.pps", WithWindow:=False)
'And once the file is opened, create a new "edit" window for it.
EditPres.NewWindow



© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext