Command button in Powerpoint

J

Jerry Anderson

I have a command button on a Powerpoint slide titled "cmdExit". I have turned
off the "right click" menu, and want the application to quit when I click on
the button. I have entered the following code:

Private Sub cmdExit_Click()

With Application.Presentations("Technology Team.ppt")
.Saved = True
.Close
End With

End Sub

When I click the button, it does't do anything. What am I doing wrong?
 
C

Chirag

Does it throw any error that it is not able to find the ppt? For closing the
active presentation, the following single line would do the job:

ActivePresentation.Close

Please this in the button Click() handler.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
J

Jerry Anderson

Chirag-
Thanks for responding. I did as you suggested, but still no response. When I
click on the button, it makes a slight move, but nothing else.
Most of the work I do with VBA is in Access; there, you must set the "Event"
property of the control in order for it to see that there is an attached
module. I don't see such a property on the Powerpoint control. Am I missing
something here?
 
C

Chirag

In PowerPoint, all macros associated with shapes on slides in a presentation
get executed only during slide show. You seem to be trying to click the
button in the slide design view. The button click event handler won't get
executed in the design view. You need to start the slide show (press F5) and
then click on that button.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 

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