VBA-Intercept open command

E

Edward

Hi,
I used Steve's suggestion and his code to intercept the open command

Private Sub PPTEvent_PresentationOpen(ByVal Pres As Presentation)
Dim result As VbMsgBoxResult
If Pres.Designs(1).Name = "My-CoverPage" Then
result = MsgBox("This file is created by PP2003 addin. To continue you
need to convert the file to PP2007 format" & vbCr & "Continue?", vbQuestion +
vbYesNo + vbDefaultButton1, CompName)
If result = vbNo Then
Pres.Saved = msoCTrue
Pres.Close
Else
'Call ConvertTO2007
End If
End If

but the line that closes the newly opend presentation "Pres.Close"
generates the following error
Presentation(Unknown number),invalid request.This operation cannot be
performed in this event handler.
Any suggestion what I'm doing wrong here. I need to be able to close the
newly opend PP if it doesn't pass the condition.
 
E

Edward

Never mind I used
PPTEvent_AfterPresentationOpen
insetad of
Private Sub PPTEvent_PresentationOpen
and this solved the problem
 
Top