我正在尝试在 Powerpoint 中制作问答游戏。
我在幻灯片中添加了一个文本框。如何编写代码,以便将输入的文本识别为以前编写的文本?
例子:
在当前文本框中...用户键入“ New Delhi
”(这是正确答案)。他们应该被重定向到下一张幻灯片。
或者
如果用户输入“ Mumbai
”(这是错误的答案);他们应该被重定向到上一张幻灯片。
若要从 ActiveX 文本框中读取文本,请使用文本框形状的 .OLEFormat.Object.Text 属性。这是一个小例子:
Function ReadActiveXTextBox(oSh As Shape) As String
With oSh.OLEFormat.Object
MsgBox .Text
End With
End Function
Sub TestTheFunction()
' Put an activex textbox on slide 1
' Make sure its name is TextBox1
' Add another shape, give it an action setting of Run Macro: TestTheFunction
' Put the presentation in slideshow view,type something into the text box, then
' click the other shape with the macro setting
MsgBox ReadActiveXTextBox(ActivePresentation.Slides(1).Shapes("TextBox1"))
End Sub
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句