我有一個列表框添加到用戶窗體。當我設置一個屬性,通過代碼添加一個項目等時,沒有任何東西出現在列表框中。我沒有收到錯誤,列表框只是空白。 這是一個片段。我查看了列表框屬性,並且Enabled和Visible都是true,Locked是false。Excel VBA - UserForm列表框不填充
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
這個代碼是用戶窗體裏面?將'userform1.BackColor'更改爲'me.BackColor' –