如何在Powerpoint中制作带有粗调和微调旋钮的记分牌

时间:2014-12-15 13:02:10

标签: vba powerpoint activexobject

VBA新手和第一次海报在这里。对不起,如果我犯了任何新手的错误。

我是老师,我正试图在Powerpoint中制作一个Jeopardy游戏。我试图解决每日双打投注。我想要一个在文本框中有赌注的幻灯片,可以使用两个旋钮中的任何一个进行调整。这基本上是一个粗略和精细的调整。我已经解决了逻辑,但我似乎无法使用VBA更改旋转按钮的.Value属性。我试过了

第1单元

Sub InitializeScoreBoard()
    ActivePresentation.Slides("ddWager").Shapes("SpinButton1").OLEFormat.Object.Value = 0
    ActivePresentation.Slides("ddWager").Shapes("SpinButton2").OLEFormat.Object.Value = 0
End Sub

Slide 117

Public Sub SpinButton1_Change() 'I changed to Public because I thought the spinbuttons were having trouble seeing each other or the code within the Sub's
    ActivePresentation.SlideShowWindow.View.Slide.Shapes("wagerTextBox").TextFrame.TextRange.Text = Me.SpinButton1.Value 'commands the textbox to display the spinbutton1's value as the spinbutton is manipulated
    ActivePresentation.SlideShowWindow.View.Slide.Shapes("SpinButton2").OLEFormat.Object.Value = Me.SpinButton1.Value 'supposed to tie SpinButton2's .Value to SpinButton1's .Value

End Sub

Public Sub SpinButton2_Change() 'I changed to Public because I thought the spinbuttons were having trouble seeing each other or the code within the Sub's
    ActivePresentation.SlideShowWindow.View.Slide.Shapes("wagerTextBox").TextFrame.TextRange.Text = Me.SpinButton2.Value 'commands the textbox to display the spinbutton2's value as the spinbutton is manipulated
    ActivePresentation.SlideShowWindow.View.Slide.Shapes("SpinButton1").OLEFormat.Object.Value = Me.SpinButton1.Value 'supposed to tie SpinButton1's .Value to SpinButton2's .Value

End Sub

这不仅不起作用,而且当我运行show并操纵spinbutton1时,它会给我一个对话框,上面写着"无法设置Value属性。无效的属性值。"起初我以为这是一个数据类型不匹配,所以我尝试使用各种CInt()和CStr()命令来尝试找到匹配,但无济于事。尝试设置旋钮的.Value的其他实验都失败了。我尝试使用.ControlFormat对象,但我怀疑它只适用于Excel,而不适用于PPT。你们所有人的任何见解都将受到赞赏。如果您不想解决我的具体问题,那么有关如何使用VBA(在powerpoint中)设置旋转按钮值的一般建议也会有所帮助。谢谢!

0 个答案:

没有答案