我有一个添加到用户窗体的列表框。当我通过代码设置属性、添加项目等时,列表框中没有任何内容。我没有收到错误,列表框只是保持空白。这是一个片段。我查看了列表框属性,启用和可见为真,锁定为假。
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