如何在 MS Powerpoint 中使用带有 VBA 的文本框?

How do I work with a textbox with VBA in MS Powerpoint?

我正在尝试用 Powerpoint 制作问答游戏。

我在幻灯片中添加了一个文本框。如何编写代码,以便将其中输入的文本识别为以前编写的文本?

示例:

在当前的文本框中...用户键入“New Delhi”(这是正确答案)。他们应该被重定向到下一张幻灯片。

如果用户键入“Mumbai”(这是错误的答案);他们应该被重定向到上一张幻灯片。

针对你的问题,相信看了下面的视频你会找到答案的。

我三个月前在用 powerpoint 创建测验时问过类似的问题。

https://www.youtube.com/watch?v=3WbJCGoSzhU&feature=youtu.be

祝你好运

饼干

要从 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