我有另外一个问题,询问使用几个布尔单选按钮询问调查问题的逻辑,位于here。我遇到的问题是让文本框填充一个单独的幻灯片,以显示将根据他们的单选按钮输入影响客户的系统。
这篇文章试图找到一种方法来减少创建,放置和格式化文本框所需的代码。下面的代码是我到目前为止的代码,但它一直告诉我它需要一个" ="我跑的时候。
Public Sub textBox(t As Integer, l As Integer, w As Integer, h As Integer, Sys As String)
Dim myTB As Shape
With ActivePresentation.Slides(7)
Set myTB = .Shapes.AddTextbox(msoTextOrientationHotizontal, l, t, w, h)
myTB.TextFrame.TextRange.Text = Sys
myTB.TextFrame.TextRange.Font.Color.RGB = RGB(255,255,255)
myTB.TextFrame.TextRange.Font.Size = 20
End With
End Sub
我认为在声明变量时我可能有错误。我想要做的只是将textBox(200,300,200,25," ERP名称")放入我的If Then或Case语句中以格式化框。有更好的方法吗?
答案 0 :(得分:0)
您需要使用
CALL textBox(parm, parm, ... , parm)
或省略括号。
为了清除所有内容,这是一个起点:
Sub ClearTheField()
Dim oSl As Slide
Dim oSh As Shape
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
If oSh.Type = msoOLEControlObject Then
If Left$(oSh.OLEFormat.Object.Name, Len("TextBox")) = "TextBox" Then
oSh.OLEFormat.Object.Text = ""
End If
If Left$(oSh.OLEFormat.Object.Name, Len("CheckBox")) = "CheckBox" Then
oSh.OLEFormat.Object.Value = False
End If
If Left$(oSh.OLEFormat.Object.Name, Len("CommandButton")) = "CommandButton" Then
oSh.OLEFormat.Object.Caption = "I changed too"
End If
End If
Next
Next
End Sub