Discussion Locked

Excel/VBA - populate listbox

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I would like to populate my listbox with the names of all .xls workbooks currently open. My objective would be to capture the name of the .xls so that i can copy from one workbook and paste link into another workbook. This is the only way that i can think to do this. If you have a better idea, please share it with me.

3 replies

by dklippert

This piece of code may give you some ideas:

Sub OpenWorkbooks()
Dim WB As Excel.Workbook
For Each WB In Workbooks
MsgBox WB.Name
Next WB
'This creates an array you can be refer to by number
MsgBox Workbooks(1).Name

End Sub

This discussion is closed to new replies.