[英]Excel VBA - UserForm ListBox Not Populating
I have a listbox added to a userform. 我有一个列表框添加到用户窗体。 When I set a property, add an item, etc. via code, nothing appears in the listbox.
当我通过代码设置属性,添加项目等时,列表框中没有任何内容。 I don't get an error, the listbox just remains blank.
我没有收到错误,列表框只是空白。 Here's a snippet.
这是一个片段。 I reviewed the listbox properties and Enabled and Visible are true, Locked is false.
我查看了列表框属性,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
代码没有错误并且有效,但我必须更改列表框的前景才能看到该项目
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.