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
' ----------------------------------------------------
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
' ----------------------------------------------------