Why does one have to click on the cmd button twice

  • Thread starter Thread starter Phil K
  • Start date Start date
P

Phil K

PPT 2003 on Vista ..
I have two CMD buttons that I click on one to display new numbers and the
second to show the correct answer. I have to click on the second buttoon
twice. I don't why becasue on slides from previous files it takes one click
to display the data. I tried to match the properties thinking it is a focus
issue, but all the properties seem to be the same. I can post the code if it
is important.

Thanks ... Phil
 
Yes, the code you are using will be helpful. Also, check to see if there is
an entrance animation added to the shape you show for the correct answer.
 
Dim Length, Width


Private Sub CommandButton1_Click()

'New Problem
Length = Int((15 - 8 + 1) * Rnd + 8)
Width = Int((3 - 7 + 1) * Rnd + 6)

ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
20").Visible = msoFalse
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
21").Visible = msoFalse

ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
20").TextFrame.DeleteText
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
21").TextFrame.DeleteText
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
24").TextFrame.DeleteText
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
28").TextFrame.DeleteText
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
30").TextFrame.DeleteText

ActivePresentation.SlideShowWindow.View.Slide.Shapes("Label1").TextFrame.DeleteText

ActivePresentation.SlideShowWindow.View.Slide.Shapes("Label2").TextFrame.DeleteText

Label1.Caption = Length
Label2.Caption = Width



End Sub

Private Sub CommandButton2_Click()

ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
24").TextFrame.TextRange.Text = "Answer"
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
30").TextFrame.TextRange.Text = "Gallons"

ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
28").TextFrame.TextRange _
.Text = Format((((Label1.Caption) * 7.5 * 0.785 * (Label2.Caption) *
(Label2.Caption)) / 1728), "0.###")

'Answer Box
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
24").TextFrame.TextRange.Font.Bold = True
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
24").TextFrame.TextRange.Font.Name = "Arial"
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
24").TextFrame.TextRange.Font.Size = 24
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
24").TextFrame.TextRange.Font.Color.RGB = vbBlue

'Correct Answer
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
28").TextFrame.TextRange.Font.Bold = True
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
28").TextFrame.TextRange.Font.Name = "Arial"
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
28").TextFrame.TextRange.Font.Size = 24
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
28").TextFrame.TextRange.Font.Color.RGB = vbBlue

ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
30").TextFrame.TextRange.Font.Bold = True
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
30").TextFrame.TextRange.Font.Name = "Arial"
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
30").TextFrame.TextRange.Font.Size = 24
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
30").TextFrame.TextRange.Font.Color.RGB = vbBlue


End Sub
 
Hi Phil

You don't need to use command buttons or labels at all if I have correctly
understood. Simple action buttons or shapes will work fine.

Also a lot of your code seems unnecessary. Have a look at this example and
see if it's close to what you need.

http://www.pptalchemy.co.uk/math.ppt

(The actual maths for the answer may not be correct as I don't fully
understand what you are trying to do)
--
john ATSIGN PPTAlchemy.co.uk

Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
 
Back
Top