Auto Run Macro

C

Crumplezone

Version: 2004
Operating System: Mac OS X 10.3 (Panther)
Processor: Power PC

I need a Powerpoint presentation to make Powerpoint (or Powerpoint viewer) automatically quit at the end of the presentation. I've looked at many web sites which give me a partial solution, but I think I need a step by step guide as I can't get anything to work. Maybe the Mac version is different, I don't know.

I have this bit of script

Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = _
SSW.Presentation.SlideShowSettings.EndingSlide Then

MsgBox "Last slide in the slide show"
End If
End Sub

Apparently an event is triggered every time a slide changes and also when the last slide is reached. The above script should trigger a message box when the last slide is reached apparently.

So in theory all I have to do is use this bit of script

Sub quit()
'
Application.quit
Set ppApp = Nothing
'

End Sub

instead of the message box bit of the script and that will make Powerpoint automatically quit.

I can get the application to quit on a mouse click by assigning it to a bit of text using action settings, but I can't for the life of me work out how to get it to run automatically on the 'last slide' event.

I don't know if I'm just being dumb, I haven't used Powerpoint too much, but I can usually work out stuff like this from articles I find on the web, but I've been messing about with this for a couple of days and got nowhere. I've tried a few things, one article said that there should be a 'PPTEvent' in the Object browser, but I couldn't find it. Obviously the program help isn't much help.

Any help greatly appreciated.
 
J

Jim Gordon MVP

Version: 2004
Operating System: Mac OS X 10.3 (Panther)
Processor: Power PC

I need a Powerpoint presentation to make Powerpoint (or Powerpoint viewer) automatically quit at the end of the presentation. I've looked at many web sites which give me a partial solution, but I think I need a step by step guide as I can't get anything to work. Maybe the Mac version is different, I don't know.

I have this bit of script

Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = _
SSW.Presentation.SlideShowSettings.EndingSlide Then

MsgBox "Last slide in the slide show"
End If
End Sub

Apparently an event is triggered every time a slide changes and also when the last slide is reached. The above script should trigger a message box when the last slide is reached apparently.

So in theory all I have to do is use this bit of script

Sub quit()
'
Application.quit
Set ppApp = Nothing
'

End Sub

instead of the message box bit of the script and that will make Powerpoint automatically quit.

I can get the application to quit on a mouse click by assigning it to a bit of text using action settings, but I can't for the life of me work out how to get it to run automatically on the 'last slide' event.

I don't know if I'm just being dumb, I haven't used Powerpoint too much, but I can usually work out stuff like this from articles I find on the web, but I've been messing about with this for a couple of days and got nowhere. I've tried a few things, one article said that there should be a 'PPTEvent' in the Object browser, but I couldn't find it. Obviously the program help isn't much help.

Any help greatly appreciated.

Hi,

When you are in the visual basic editor search HELP (not the object
browser) for the word

event

You will get a list of all events available to you along with code samples.

-Jim

--
Jim Gordon
Mac MVP


WE NEED YOUR HELP!
The number of new Mac users has skyrocketed. That’s excellent. In this
forum all answers come from other users, not from Microsoft employees.
Please help answer questions.

If you see an unanswered question that you know the answer to, please
take just a moment to post the answer. Doing so speeds response time for
people who come here and need fast responses.

If you see an answer that might be wrong or that you can answer better,
hop right in and offer your thoughts. Don’t berate a wrong answer –
we’re all here trying to help each other.

Don’t bother with questions you’re not quite sure about or don’t know about.

Please take just a moment to help fellow Mac users. Your efforts will be
appreciated greatly - especially by those you help.
 
C

Crumplezone

Sorry, I'm still utterly clueless about the procedure to make this work. I think I understand the principles involved and the script, but I don't know exactly how to get it to run with the presentation.

I assume I should have code something like this

Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = _
SSW.Presentation.SlideShowSettings.EndingSlide Then

Application.quit
Set ppApp = Nothing

End Sub

I assume that when the script is told that it has reached the last slide it should execute the quit command.

I'd be really grateful if some one could take me through this step by step or at least get me started.
 
S

Steve Rindsberg

When you are in the visual basic editor search HELP (not the object
browser) for the word

event

You will get a list of all events available to you along with code samples.

I thought event support didn't appear until PPT went to VBA6; it never did that on the Mac.
Do the event code samples really work or are they just another Help-writer's fevered
dream?

================================================
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 
S

Steve Rindsberg

I need a Powerpoint presentation to make Powerpoint (or Powerpoint viewer) automatically
quit at the end of the presentation. I've looked at many web sites which give me a partial
solution, but I think I need a step by step guide as I can't get anything to work. Maybe
the Mac version is different, I don't know.

If you save the presentation as a show rather than as a PPT it should do this once the user
advances past the last slide.

Or you could fill the last slide with a black rectangle which you've given a mouseover
action of "End Show".

As soon as the user moves the mouse on that slide, game over.
I have this bit of script

Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = _
SSW.Presentation.SlideShowSettings.EndingSlide Then

MsgBox "Last slide in the slide show"
End If
End Sub

Apparently an event is triggered every time a slide changes and also when the last slide
is reached. The above script should trigger a message box when the last slide is reached
apparently.
So in theory all I have to do is use this bit of script

Sub quit()
'
Application.quit
Set ppApp = Nothing
'

End Sub

instead of the message box bit of the script and that will make Powerpoint automatically quit.

I can get the application to quit on a mouse click by assigning it to a bit of text using
action settings, but I can't for the life of me work out how to get it to run automatically
on the 'last slide' event.
I don't know if I'm just being dumb, I haven't used Powerpoint too much, but I can
usually work out stuff like this from articles I find on the web, but I've been messing
about with this for a couple of days and got nowhere. I've tried a few things, one article
said that there should be a 'PPTEvent' in the Object browser, but I couldn't find it.
Obviously the program help isn't much help.
Any help greatly appreciated.

================================================
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 
C

Crumplezone

Good idea Steve, but I've found that the pointer needs to be outside the rectangle, then move over it, so with a full screen rectangle, the mouse can't move out of it. A static mouse pointer won't trigger the event.
 
S

Steve Rindsberg

Good idea Steve, but I've found that the pointer needs to be outside the rectangle, then
move over it, so with a full screen rectangle, the mouse can't move out of it. A static mouse
pointer won't trigger the event.

It may depend on Mac vs. Windows vs. version vs. Viewer vs. full PPT vs. How We Hold Our
Mouth That Day ... I've used this dodge w/o problems but that would've been under Windows.

Another approach would be to create a kind of grid of rectangles so that there are spaces
between them; the user'd have to move the mouse, but not much.



================================================
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 
C

Crumplezone

I read that page before and came unstuck at step 4 as Object Variable PPTEvent wasn't listed.

I've had a quick look at the demo supplied on that page. Is it supposed to do something when the buttons are clicked? It doesn't.

This presentation will eventually be run on a touch screen attached to a Windows PC. This would probably make the grid idea a non-starter too.

I have access to PCs, so it sounds like I might be better trying to do this on a PC version of Powerpoint instead.
 
S

Steve Rindsberg

I read that page before and came unstuck at step 4 as Object Variable PPTEvent wasn't listed.

I've had a quick look at the demo supplied on that page. Is it supposed to do
something when the buttons are clicked? It doesn't.
This presentation will eventually be run on a touch screen attached to a
Windows PC. This would probably make the grid idea a non-starter too.
I have access to PCs, so it sounds like I might be better trying to do this
on a PC version of Powerpoint instead.

I expect so. As I mentioned earlier, Mac PPT versions have never supported
event-handlers, to the best of my knowledge.

================================================
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 
J

Jim Gordon MVP

Good idea Steve, but I've found that the pointer needs to be outside the rectangle, then move over it, so with a full screen rectangle, the mouse can't move out of it. A static mouse pointer won't trigger the event.

Hi,


Try this:

Make a shape that you want to be the trigger. Set the shape so that has
no fill and no border and put it on top of the rectangle that you want
to be visible.

-Jim

--
Jim Gordon
Mac MVP


WE NEED YOUR HELP!
The number of new Mac users has skyrocketed. That’s excellent. In this
forum all answers come from other users, not from Microsoft employees.
Please help answer questions.

If you see an unanswered question that you know the answer to, please
take just a moment to post the answer. Doing so speeds response time for
people who come here and need fast responses.

If you see an answer that might be wrong or that you can answer better,
hop right in and offer your thoughts. Don’t berate a wrong answer –
we’re all here trying to help each other.

Don’t bother with questions you’re not quite sure about or don’t know about.

Please take just a moment to help fellow Mac users. Your efforts will be
appreciated greatly - especially by those you help.
 

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