View Full Version : PowerpointXP and VBA

27-09-2004, 03:27 PM
Hi - I am trying to intercept the filesave/ filesave as command but can not seem to do so. I want to be able to launch a userform beforehand, that takes user info and then use some of that data to construct filename. any ideas welcome

27-09-2004, 04:20 PM
Ive only got access to PPT97 at work which doesnt support events (how crap is that?) but these pages here may assist.


Also see the link to the event capture add-in which may help. I can see a Save event, but what you really need is a BeforeSave event. You might be able to motiro certain keystokes but dunno if this would work very well. Another alternative may be to disable the save/save as buttons but may not be a desirable route to take.

Why MS have such an inconsistent approach between apps in the Office Suite I dont know. Theres BeforeSave (and far more) available in Excel but events in Ppt, Word and Outlook are either non existent or poorly implemented. Good luck. :-)

27-09-2004, 04:28 PM
Hi Parry,
Thanks for your reply.
I know where you are coming from but really it is not the event but the routine itself i want to replace as I cant pass info to the dialog box before it exits.
replacing the save routine allows me to construct as I like.
I know in word you just create a module with a subroutine called FileSave and/or FileSaveAs and tehse take preference to the inbuild routines.
Just can't find a way to do it in powerpoint - Grrrrrr.

27-09-2004, 05:09 PM
Hi I think we are talking about the same thing. FileSave or FileSaveAs are effectively event procedures as they capture the action, and are procedure names which mean something to the application.

The trouble is finding what these are. The OnPresentationSave macro indicated in the link http://officeone.mvps.org/eventgen/eventgen.html may work for you if you have PPT 2000 or later.


27-09-2004, 10:08 PM
OK, Ive sussed this now. You will need PPT 2K or better or else your SOL.

1. Download & install the free AutoEvents Add-in (http://www.mvps.org/skp/autoevents.htm)
2. Create a Class Module in VBA (Insert|Class Module) & insert the following code. Replace the name of your userform & add more code as required.
Option Explicit

Public WithEvents App As Application

Private Sub App_PresentationBeforeSave(ByVal Pres As Presentation, Cancel As Boolean)
'Show UserForm

'Prevent the save action that's just occurred
Cancel = True

End Sub3. Insert a standard module (Insert|Module) and place the following code in it. Note that I renamed my Class Module to EventClassModule - select Class1 in project window(left window) and press F4 then rename it. If you decide not to rename it then substitute the name EventClassModule for Class1 (or whatever you named it) in the code below....
Option Explicit

Dim X As New EventClassModule
Sub InitializeApp()
Set X.App = Application
End Sub

Sub Auto_Open()
Call InitializeApp
End Sub

28-09-2004, 09:18 AM

What can I say - YOU ARE THE MAN !!!!!
Thank you for your assistance and the time taken in investigating for me.
Very much appreciated

28-09-2004, 01:14 PM
Excellent, glad it worked for you. The investigation was worthwhile as I know how to handle events in PPT myself now. :D