Hello,
I have spent a lot of time finding a solution for my problems but I am still blocked
Here is a sample of my code :
[vba]
Private sub test()
Dim cpt,nb_usage,size as Integer
cpt = 1
nb_usage = 1
size = 30
While ActiveWorkbook.Sheets(idSheet).Range("E" & cpt).FormulaR1C1 <> ""
Set Obj = UserForm1.FrameUsage.Controls.Add("Forms.CheckBox.1")
With Obj
.Name = "C" & nb_usage
.Object.Caption = ActiveWorkbook.Sheets(idSheet).Range("D" & cpt).FormulaR1C1
.Left = 6
.Top = 25 + size
.Width = 120
.Height = 35
.Visible = True
.ForeColor = &H0&
.FontBold = False
.FontSize = 8
End With
AddHandler("Check" & nb_usage).Change , AddressOf abc
cpt = cpt + 1
size = size + 30
nb_usage = nb_usage + 1
Wend
End Sub
Private Sub abc()
MsgBox ("test")
End Sub
[/vba]
The checkbox is created but the problem is the AddHandler. Excel told me that AddressOf is not correct... ?? *
Other problem :
I want to create a progressbar dynamically but the following syntax is not working :
[vba]
Set Obj2 = UserForm1.FrameUsage.Controls.Add("Forms.ProgressBar.1")
With Obj2
.Name = "P" & nb_usage
.Object.ControlTipText = "10%"
.Left = 130
.Top = 25 + size
.Width = 50
.Height = 20
.Visible = True
End With
[/vba]
Forms.ProgressBar is unknow ...
Somebody helps ? Thank you !