Run macro on slide change

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

With PPT2002

I'm looking for VBA code that will run a macro when there's a slide change
in slide show view. Can this be done? If yes, can you point me in the right
direction? Thanks.

Bob
 
Hi Bob,

You should start by looking at
**Make PPT respond to events
http://www.rdpslides.com/pptfaq/FAQ00004.htm

--
Bill Dilworth
Microsoft PPT MVP Team
Users helping fellow users.
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of our questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..
 
Thanks, Bill. I'll check it out.
Bob

Bill Dilworth said:
Hi Bob,

You should start by looking at
**Make PPT respond to events
http://www.rdpslides.com/pptfaq/FAQ00004.htm

--
Bill Dilworth
Microsoft PPT MVP Team
Users helping fellow users.
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of our questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
.
.
 
Bill,
The info on event handlers at replies.com is over my head. Any suggestions
how I might get a better handle on this material?

Bob
 
Instead of figuring out Event Handlers, why not set your presentation to be
"Browsed as a KIOSK". Have action buttons (Next Slide) on each slide. On
the desired slide, change the action setting of your "Next Slide" button to
run a macro instead of "Hyperlink to...Next Slide". In your macro code
include the line that takes you to the next slide as well.

ActivePresentation.SlideShowWindow.View.Next

Just a thought!

--
Bill Foley, Microsoft MVP (PowerPoint)
Microsoft Office Specialist Master Instructor
www.pttinc.com
Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
"Success, something you measure when you are through succeeding."
 
Hi, Bill.
Thanks for your interest. The slide show is already set to kiosk mode.
Here's my situation:

I've got a slide with text boxes organized into a table. Let's say the table
has 4 columns and 4 rows - this includes column and row headers. Many
buttons throughout the presentation have action settings that run macros
that display this slide with the table. There are almost 20 different
buttons that navigate to the slide in question. Each button's macro
emphasizes a different combination of table cells (text boxes) by changing
the fill and font color. The text content in all table cells remains
consistent regardless of the fill and font color. The following code is an
example of a macro. I'm teaching myself as I go along. I haven't figured out
the code for the font color changes yet. Suggestions are appreciated.

ActivePresentation.SlideShowWindow.View.GotoSlide (("Skills SP")
'Apply a light green foreground color to text boxes SP A1-5
ActivePresentation.SlideShowWindow.View.Slide.Shapes _
..Range(Array("SP A1", "SP A2", "SP A3", "SP A4", "SP A5")) _
..Fill.ForeColor.RGB = RGB(204, 255, 204)

Issues:
The code runs much slower than I expected. The slide change takes noticeably
longer than if I used the hyperlink action setting.

Once the slide with the table displays, there's a one second pause before
the shading is applied. I'd like the slide to appear with the shading
already applied.

I was considering the event handler to change the table text boxes back to
the original fill and font color when the slide changed. Otherwise, I'm
thinking that every button on the table slide that takes the user to a
different slide will need to contain code that resets the colors. It seems
if I don't reset the colors when the user leaves the slide, the next time
they view the slide for a different combination of emphasized table text
boxes, the slide will initially display briefly with the previous emphasis
before the code can change to the new fill and font.

Question:
Is it expected that this code will execute as if in slow motion?

Comment:
I took over this project from someone who created separate slides for each
different combination of emphasized table text boxes and used action
settings to link to the slide with the appropriate shading. I was hoping I
could reduce the number of slides in the presentation considerably by using
code to provide the emphasis. When I saw how slow the code was executing, I
went back to the original solution, but now the presentation has over 200
slides.

Question:
Should I expect users to have serious problems with a 200+ slide show almost
5MB large?

Thanks.
 
It might be that the size of your show is what is slowing everything
down. You should be able to do what you want with fewer slides now that
you are using code.

For this code:

ActivePresentation.SlideShowWindow.View.GotoSlide (("Skills SP")
'Apply a light green foreground color to text boxes SP A1-5
ActivePresentation.SlideShowWindow.View.Slide.Shapes _
.Range(Array("SP A1", "SP A2", "SP A3", "SP A4", "SP A5")) _
.Fill.ForeColor.RGB = RGB(204, 255, 204)

You should change this to:

ActivePresentation.Slides("Skills SP").Shapes _
.Range(Array("SP A1", "SP A2", "SP A3", "SP A4", "SP A5")) _
.Fill.ForeColor.RGB = RGB(204, 255, 204)
ActivePresentation.SlideShowWindow.View.GotoSlide (("Skills SP")

This will apply the fill before going to the slide so that it will be
filled when you get there.

Having every button reset fill colors is not a big deal if you write a
separate procedure to do this. Each button can call the separate
procedure:

Sub ResetFillColors()
ActivePresentation.Slides("Skills SP").Shapes.Range ....
End Sub


You might also want to check out my site for some examples that change
the font color of text:

http://www.loyola.edu/education/PowerfulPowerPoint/

Example 6.8 does that.

I think the big key to solve many of your problems is always to change
the things on slides before going to those slides.

--David

--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 

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

Back
Top