0

我想根据模块内的输入框值更改报告中文本框的值。

Public Sub ChangeTextBox()
Dim UserText As String

UserText = InputBox("Enter The Value")
'The part I don't understand is how to branch out to the text box name
'I know you have to do something like Form!Formname.textbox name but I'm so confused
'How do I link it to the textbox from within module?

谢谢

4

1 回答 1

0

试试下面的代码。

formname 是表单名称 txtName 是文本框名称

Public Sub ChangeTextBox()
    Dim UserText As String


    UserText = InputBox("Enter The Value")

    If UserText <> "" Then
        ActiveCell.Value = s
        formname.txtName = "dfd" ' where txtName is textbox name
    End If

End Sub

在此处输入图像描述

对象浏览器视图 在此处输入图像描述

在此处输入图像描述

于 2013-04-13T04:37:51.030 回答