答案 0 :(得分:1)
从此source开始,您可以将此代码放入UserForm.Initialize
过程中,例如:
Private Sub UserForm_Initialize()
Dim I As Long, TempString As String
UserForm1.ComboBox1.ColumnCount = 2
TempString = LTrim$(Str$(UserForm1.ComboBox1.Width - 15))
UserForm1.ComboBox1.ColumnWidths = TempString & " pt; 15 pt"
For I = 1 To 10
UserForm1.ComboBox1.AddItem "Hello" & Str$(I)
Next I
End Sub
另一个对我有用的选项是:
Private Sub UserForm_Initialize()
Dim I As Long
For I = 1 To 10
UserForm1.ComboBox1.AddItem "Hello " & I & " "
Next I
End Sub
最后一个选项将仅放置足够的尾随空格以使文本完整显示。请注意,使用这些值时,您将不得不TRIM
降低它们。