Active Presentation vs Open Presentation

T

Trevor Williams

Hi All,

What code should I use to detect if a presentation is already open?
I can only work out stuff relating to ActivePresentation

Thanks
 
S

Shyam Pillai

Trevor,
To check if a presentation is already open you need to iterate thru the
presentation collection.

' ---------------------------------------------------------------------------------------
Function IsPresentationOpen(Filename As String) As Integer
Dim Index As Integer
For Index = 1 To Presentations.Count
If LCase(Presentations(Index).FullName) = LCase(Filename) Then
'Return the Index of the presentation if open
IsPresentationOpen = Index
Exit Function
End If
Next Index
IsPresentationOpen = 0
End Function

Usage:
Sub Test()
If IsPresentationOpen("E:\Docs\individual notes potrait.ppt")>0 then
MsgBox "Presentation is open"
Else
Msgbox "Presentation is not open"
End If
End Sub
'----------------------------------------------------------------------------------------
 
T

Trevor Williams

Excellent - Thanks Shyam

Shyam Pillai said:
Trevor,
To check if a presentation is already open you need to iterate thru the
presentation collection.

' ---------------------------------------------------------------------------------------
Function IsPresentationOpen(Filename As String) As Integer
Dim Index As Integer
For Index = 1 To Presentations.Count
If LCase(Presentations(Index).FullName) = LCase(Filename) Then
'Return the Index of the presentation if open
IsPresentationOpen = Index
Exit Function
End If
Next Index
IsPresentationOpen = 0
End Function

Usage:
Sub Test()
If IsPresentationOpen("E:\Docs\individual notes potrait.ppt")>0 then
MsgBox "Presentation is open"
Else
Msgbox "Presentation is not open"
End If
End Sub
'----------------------------------------------------------------------------------------

--
Regards,
Shyam Pillai

Animation Carbon: http://skp.mvps.org/ac/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top