Action Settings work on Windows, but not Mac

M

Master Ninja

I have a PowerPoint presentation that I am using as a score board.
It's just one slide with four text boxes on it. I've applied an action
setting to each text box that runs a macro to either increase or
decrease the score of one of the teams when clicked on in slideshow
mode. I've coded the macros to work in either edit mode or slideshow
mode. It works perfectly on a Windows XP machine with the latest
version of PowerPoint. However on Mac OS X with PowerPoint 2004 (the
latest), while the macros work correctly in edit mode, they do not work
in slideshow mode. Specifically what happens is when I click on one of
the text boxes in slideshow mode, all that happens is the cursor turns
from the little click-link finger to a normal arrow pointer. After
that I never get the little click-link finger so I can't click on any
of the text boxes again. The score does not update. When I go back to
edit mode the score will then be updated. This makes me think that
macro is being ran, but the screen is not being updated after the
scores are updated.

Here are the steps I took to apply Action Settings to the text boxes:

1) Right-click on a text box, select "Action Settings"
2) Select "Run Macro" radio button
3) Set macro to (for example) "AddHome"

I've copied all of the macro code below. You may notice that different
code is being ran for edit mode. I've tried removing all of the edit
mode code, but that didn't help anything.

If anyone would like to download the presentation itself, I have placed
it at my website at "Scoreboard.ppt":

http://www.geocities.com/daveinmatrix/

Thank you in advance for any help you can provide!

-- DaveInMatrix


' ----------------------------------------------------

Option Explicit

Const STR_TEXT_HOME_SCORE = "Text Box 32"
Const STR_TEXT_VISITOR_SCORE = "Text Box 34"

' Adds an amount to a text box that contains an integer.
' Use negative numbers to subtract. Call like this:
' UpdateScore STR_TEXT_HOME_SCORE, 1
Sub UpdateScore(strBox As String, nAddAmount As Integer)
' The objects on the slide have different parent objects
' depending on whether the slideshow is currently running
' or we are in editor mode. So different macro code is
' required in each situation. To get around this, trap
' the error that occurs when we attempt to access a
' slideshow object in editor mode. Then go to the editor
' mode alternative code.
On Error GoTo UseEditModeCode

' Code that works in slideshow mode but not editor mode
With
ActivePresentation.SlideShowWindow.View.Slide.Shapes(strBox).TextFrame.TextRange
.Text = .Text + nAddAmount
End With
Exit Sub

UseEditModeCode:
' Code that works in editor mode but not slideshow mode
With
ActiveWindow.Selection.SlideRange.Shapes(strBox).TextFrame.TextRange
.Text = .Text + nAddAmount
End With
End Sub

Sub AddHome()
UpdateScore STR_TEXT_HOME_SCORE, 1
End Sub

Sub SubHome()
UpdateScore STR_TEXT_HOME_SCORE, -1
End Sub

Sub AddVisitor()
UpdateScore STR_TEXT_VISITOR_SCORE, 1
End Sub

Sub SubVisitor()
UpdateScore STR_TEXT_VISITOR_SCORE, -1
End Sub

' ----------------------------------------------------
 
D

David M. Marcovitz

One of my students recently had a similar (but not identical) issue. The
solution was to add a line of code to go to the current slide any time
something changed. This is from memory:

ActivePresentation.SlideShowWindow.View.GotoSlide _
ActivePresentation.SlideShowWindow.View.Slide.SlideIndex

Stick this (or if I got it wrong from memory, the right code) after every
line of code that should change what is on the slide.

--David

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

Master Ninja

Steve said:
First suggestion, which probably won't be the solution but may help prevent other
bugs: Don't add apples and automobiles:

.Text + nAddAmount

isn't a good idea.

.Text = Cstr(Val(.Text) + nAmount)

or something along those lines might be better. In other words, convert the
string in the text box to the number it "looks like", increment that number, then
convert the result back to string.

I'd also set break points and step through the code to see exactly how far it gets
the first time you click on the link and invoke the macro.

Thank you for your suggestion, Steve. I changed the code to the line
you provided, and while it didn't do anything to resolve my problem, I
appreciate having the "correct" code.

I did try setting break points, but break points do not get triggered
in slideshow mode, but just in edit mode where I am not having a
problem. I did insert popup message boxes to aid in debugging, and
they show that all of my code is being executed without error, just
that the screen is not being properly updated after a change is made.
 
M

Master Ninja

David said:
One of my students recently had a similar (but not identical) issue. The
solution was to add a line of code to go to the current slide any time
something changed. This is from memory:

ActivePresentation.SlideShowWindow.View.GotoSlide _
ActivePresentation.SlideShowWindow.View.Slide.SlideIndex

Stick this (or if I got it wrong from memory, the right code) after every
line of code that should change what is on the slide.

Thank you, David! I will try this. Unfortunately I only have access
to the problematic Mac on Fridays, so I won't be able to test this for
a few days, but I am optimistic it will work.
 
M

Master Ninja

David said:
One of my students recently had a similar (but not identical) issue. The
solution was to add a line of code to go to the current slide any time
something changed. This is from memory:

ActivePresentation.SlideShowWindow.View.GotoSlide _
ActivePresentation.SlideShowWindow.View.Slide.SlideIndex

Stick this (or if I got it wrong from memory, the right code) after every
line of code that should change what is on the slide.

Thank you, David! I was able to test this fix on a Mac, and it
resolved the problem. It introduces a slight delay after a macro is
executed to refresh the screen, but it's worth it.
 
M

Master Ninja

Steve said:
That's odd ... they work here in either mode. Do you have the VBA editor open when
you start the show?

I did have the VBA editor open when I started the slideshow, but the
breakpoints don't get triggered for me in slideshow mode, just edit
mode. Maybe it's because I only have one monitor. Well, my original
problem has been resolved anyway, so it's not a big deal. Thanks,
 
D

David M. Marcovitz

Great. I'm glad it worked, and thanks for getting back to us to let us
know.
--David

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

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