1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| Sub Form_Modif()
Dim Usf As VBComponent
Dim obj As Object
Dim i As Integer
Set Usf = ThisWorkbook.VBProject.VBComponents.Item("frm_form1")
'###################
'### Ajoute les Objets ###
'###################
Set obj = Usf.Designer.Controls.Add("Forms.ListBox.1")
With obj
.BackColor = &H80000018
.BorderStyle = 1
.SpecialEffect = 0
.MultiSelect = 2
.Font.Name = "Courier New"
.IntegralHeight = False
.BoundColumn = 0
.Left = 0
.Top = 0
.Width = 600
.Height = 337
End With
'#################
'### Ajoute le code ###
'#################
With Usf.CodeModule
i = .CountOfLines
.InsertLines i + 1, "Private Sub UserForm_Initialize()"
.InsertLines i + 2, "AfficheList"
.InsertLines i + 3, "End Sub"
End With
End Sub |