![]() |
#1
|
|||
|
|||
![]()
Hi all,
I'm trying to write some code to update a scoreboard on a few slides of a presentation using VBA but I'm getting a bit stuck and wondered if anyone can see what I'm doing wrong? This part works absolutely fine: Code:
Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow) If SSW.View.CurrentShowPosition = 8 Then Dim Team1Scr As String Dim Team2Scr As String Team1Scr = InputBox("Enter Team 1 Score:", "Scores") ActivePresentation.Slides(8).Shapes("Scr1").TextFrame.TextRange.Text = Team1Scr Team2Scr = InputBox("Enter Team 2 Score:", "Scores") ActivePresentation.Slides(8).Shapes("Scr2").TextFrame.TextRange.Text = Team2Scr SendKeys ("{ENTER}") End If End Sub Code:
Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow) If SSW.View.CurrentShowPosition = 8 Then Dim Team1Scr As String Dim Team2Scr As String Team1Scr = InputBox("Enter Team 1 Score:", "Scores") ActivePresentation.Slides(8).Shapes("Scr1").TextFrame.TextRange.Text = Team1Scr Team2Scr = InputBox("Enter Team 2 Score:", "Scores") ActivePresentation.Slides(8).Shapes("Scr2").TextFrame.TextRange.Text = Team2Scr SendKeys ("{ENTER}") ElseIf SSW.View.CurrentShowPosition = 16 Then Dim Team1Scr As String Dim Team2Scr As String Team1Scr = InputBox("Enter Team 1 Score:", "Scores") ActivePresentation.Slides(16).Shapes("Scr1").TextFrame.TextRange.Text = Team1Scr Team2Scr = InputBox("Enter Team 2 Score:", "Scores") ActivePresentation.Slides(16).Shapes("Scr2").TextFrame.TextRange.Text = Team2Scr SendKeys ("{ENTER}") End If End Sub Many thanks, Kevin |
#2
|
|||
|
|||
![]()
You shouldn't have duplicate declarations in one module.
Try this using Select case Code:
Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow) Dim Team1Scr As String Dim Team2Scr As String Select Case SSW.View.CurrentShowPosition Case Is = 8 Team1Scr = InputBox("Enter Team 1 Score:", "Scores") ActivePresentation.Slides(8).Shapes("Scr1").TextFrame.TextRange.Text = Team1Scr Team2Scr = InputBox("Enter Team 2 Score:", "Scores") ActivePresentation.Slides(8).Shapes("Scr2").TextFrame.TextRange.Text = Team2Scr Case Is = 16 Team1Scr = InputBox("Enter Team 1 Score:", "Scores") ActivePresentation.Slides(16).Shapes("Scr1").TextFrame.TextRange.Text = Team1Scr Team2Scr = InputBox("Enter Team 2 Score:", "Scores") ActivePresentation.Slides(16).Shapes("Scr2").TextFrame.TextRange.Text = Team2Scr End Select End Sub I've removed theSendKeys lines. What were they for? The effect would be to move on to the next slide or animation. |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Serious help needed. | karlyak22 | Outlook | 0 | 11-13-2011 07:32 AM |
![]() |
ytryity | Misc | 1 | 03-19-2011 09:07 AM |
Needed help with MSI Package | ahaseeb | Outlook | 0 | 01-17-2011 10:19 PM |
![]() |
thunder14 | Word | 1 | 10-17-2009 02:57 PM |
![]() |
thechief55 | PowerPoint | 1 | 04-28-2009 01:25 PM |