是否可以确定哪些页面上的文本框有任何值?
并获取非空文本框选项卡的名称。
设置:
在第 1 页文本框 1 上,在第 2 页文本框 2 上。
如果 TextBox2 具有值 init 我需要获取页面的名称。
预先感谢!
到目前为止我尝试的是从特定文本框中获取值。
Dim z As Integer
For z = 5 To 11
If step_0.Controls("TextBox" & z).Value <> "" Then
sValue = sValue & step_0.Controls("TextBox" & z).Value & vbCrLf
End If
Next
我想用选项卡名称来完成此操作,这是一个棘手的问题,因为文本框未链接到选项卡。
经过一番思考,我找到了这个解决方案。
如果您想将多页标题与文本框结合使用,这会很方便。
代码:
a = ""
Dim r As Integer
For r = 5 To 12
'according to count of textboxes should be 1 to whatever
If UserForm1.Controls("TextBox" & r).Value <> "" Then
a = a & " " & UserForm1.MultiPage1.Pages(r - 5).Caption
'since the first page index is 0, subtract the integer. It only works if they arranged like this:
'page0-tbox1,page1-tbox2 page_n-tbox_n+1....
'a= creates a list with the captions of pages which has fulfilled textboxes.
End If
Next