我在互联网上找到了一些vba代码,它们通过命令按钮点击动态创建了许多文本框。为此,文本框和按钮已全部放在Userform上。我确实创建了第二个按钮来重复处理(动态创建多个文本框),但是这个按钮需要从动态的,第一个创建的文本框中获取值。不知何故,我无法通过我的按钮点击事件调用此文本框。有人可以帮帮我吗。非常感谢你
NSArray *objects = //Objects created on background thread with Private queue
NSMutableArray *objectsIDs = [NSMutableArray array];
for (Object *object in object) {
[objectsIDs addObject:object.objectID];
}
//Save on private managed object context and on completion...
[self.managedObjectContext saveWithCompletion:^(NSError *error) {
NSManagedObjectContext *mainMOC = [[CoreDataManager sharedManager] mainContext];
NSMutableArray *fetchedObjects = [NSMutableArray array];
for (NSManagedObjectID *objectID in objectsIDs) {
[fetchedArticles addObject:[mainMOC objectWithID:objectID]];
}
if (completion) completion(fetchedObjects, pagination, nil);
}];
End Sub
Private Sub cmdAddBoxes_Click()
Dim idx As Long
Dim maxBoxes As Long
Dim x As Long, y As Long
Dim ctl As Control
Dim newBox As MSForms.TextBox
maxBoxes = Val(txtNumBoxes.Text)
If (maxBoxes > 0) And (maxBoxes <= 1) Then
' remove any existing boxes
For Each ctl In Me.Controls
If Len(ctl.Tag) > 2 Then
If Left(ctl.Tag, 3) = "new" Then
Controls.Remove (ctl.Name)
End If
End If
Next
For idx = 1 To maxBoxes
Set newBox = Me.Controls.Add("Forms.TextBox.1")
With newBox
.Tag = "new" & .Name
.BackColor = &HC0FFFF
.Value = 1
'MsgBox "new" & .Name
'MsgBox .Value
' make two columns of boxes
If idx < 6 Then
.Left = 12
.Width = 78
.Height = 18
.Top = 16 + 24 * idx
Else
.Left = 100
.Top = 16 + 24 * (idx - 5)
End If
End With
Next
Else
MsgBox "Number must be 1 to 1"
End If
txtNumBoxes.Text = ""
Label2.Visible = True
End Sub