0

ユーザーフォームにリストボックスを追加しました。コードを使用してプロパティを設定したり、アイテムを追加したりすると、リストボックスに何も表示されません。エラーは発生しません。リストボックスは空白のままです。ここにスニペットがあります。リストボックスのプロパティを確認したところ、Enabled と Visible は true、Locked は false です。

Private Sub Refresh_Click()
ListBox1.Clear
Dim wb As Workbook
UserForm1.ListBox1.BackColor = RGB(5, 5, 5) 'threw this in for testing; box not changed
For Each wb In Workbooks
   MsgBox wb.Name
   ListBox1.AddItem wb.Name 
   'this is what I'm trying to accomplish; 
   'wb.Name shows in the MsgBox but not in the listbox
Next wb
End Sub
4

1 に答える 1

2

コードにエラーはなく動作しますが、アイテムを表示するにはリストボックスの前の色を変更する必要がありました

于 2012-12-13T07:03:04.680 に答える