lionne
07-04-2012, 03:30 AM
hi there
I've got one issue here I couldn't find a solution. I create a UserForm dynamically.
Set MetaParList = Application.VBE.ActiveVBProject.VBComponents.Add(3)
With MetaParList
'some code here, where the value of variable testcase will be set, let's say
testcase = 5
'Then I create a button here
Set OKButton = MetaParList.Designer.Controls.Add("Forms.CommandButton.1")
With OKButton
.Name = "OKButton"
.Caption = "OK"
.Width = 100
.Top = grp_height + 50
.Left = 350
End With
'Here is the code for OK-Button
With MetaParList.CodeModule
Line = .CountOfLines
.InsertLines Line + 1, "Sub OKButton_Click()"
'Here I need to use the testcase value, but how to pass it?
.InsertLines Line + 120, "End Sub"
End with
End with
Would be happy to any hints,
Thanks in advance
I've got one issue here I couldn't find a solution. I create a UserForm dynamically.
Set MetaParList = Application.VBE.ActiveVBProject.VBComponents.Add(3)
With MetaParList
'some code here, where the value of variable testcase will be set, let's say
testcase = 5
'Then I create a button here
Set OKButton = MetaParList.Designer.Controls.Add("Forms.CommandButton.1")
With OKButton
.Name = "OKButton"
.Caption = "OK"
.Width = 100
.Top = grp_height + 50
.Left = 350
End With
'Here is the code for OK-Button
With MetaParList.CodeModule
Line = .CountOfLines
.InsertLines Line + 1, "Sub OKButton_Click()"
'Here I need to use the testcase value, but how to pass it?
.InsertLines Line + 120, "End Sub"
End with
End with
Would be happy to any hints,
Thanks in advance