Sub resizeListBox(usf, listbox As Object)
'patricktoulon
'MsgBox GetSystemMetrics(36)
Dim txt, speffect, BdStyle, X&
'With listbox: .IntegralHeight = False: .Height = 0: .IntegralHeight = True: X = .Height: End With'abandon de la méthode @job75
speffect = listbox.SpecialEffect
BdStyle = listbox.BorderStyle
txt = Join(Application.Transpose(listbox.List), vbCrLf)
With usf.Controls.Add("forms.Textbox.1", "cobaie")
DoEvents
.IntegralHeight = listbox.IntegralHeight
.MultiLine = True
.Value = CStr(txt)
.Width = 500
.Height = listbox.ListCount * 30
.BorderStyle = BdStyle
.Font.Size = listbox.Font.Size
.Font.Name = listbox.Font.Name
.Font.Bold = listbox.Font.Bold
.AutoSize = True
listbox.Height = .Height
listbox.ColumnWidths = Replace(.Width & ";0", ".", ",")
listbox.Width = .Width + 3 '(Getsyemmetrics(36)
listbox.BorderStyle = BdStyle
listbox.SpecialEffect = speffect
'usf.Controls.Remove ("cobaie")
End With
End Sub