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
| Private Sub UserForm_Initialize()
Set f = Sheets("BD")
nbcol = f.[A1].CurrentRegion.Columns.Count
Me.ListBox1.ColumnCount = nbcol
Set plage = f.[A1].CurrentRegion
Set plage = plage.Offset(1).Resize(plage.Rows.Count - 1)
Me.ListBox1.List = plage.Value
i = 1
x = 15
For i = 1 To nbcol
retour = Me.Controls.Add("Forms.Label.1", "Label" & i, True)
Me("label" & i).Caption = f.Cells(1, i)
Me("label" & i).Top = 45
Me("label" & i).Left = x
x = x + f.Columns(i).Width * 1.1
'temp = temp & f.Columns(i).Width * 1.1 & ";"
temp = temp & f.Columns(i).Width * 1.1 & " pt;"
Next
Debug.Print "---------------"
Debug.Print "0. temp = " & temp
Debug.Print "1. Me.ListBox1.ColumnWidths = " & Me.ListBox1.ColumnWidths
Debug.Print "1a. Replace(temp, ., ,)" & Replace(temp, ".", ",")
Me.ListBox1.ColumnWidths = Replace(temp, ".", ",")
Debug.Print "2. Me.ListBox1.ColumnWidths = " & Me.ListBox1.ColumnWidths
Me.ListBox1.ColumnWidths = temp
Debug.Print "3. Me.ListBox1.ColumnWidths = " & Me.ListBox1.ColumnWidths
Debug.Print "4. Application.International(xlCountrySetting) = " & Application.International(xlCountrySetting)
Debug.Print "5. Format(0, .) = " & Format(0, ".")
For b = 1 To nbcol: Set Lbl(b).GrLabel = Me("Label" & b): Next b
End Sub |
Partager