The code below is supposed to take the filenames from all open excel files and add them to the listbox. I keep getting the error "Object doesnt support this property or method". I can confirm List Box 2 definity exists within Sheet 2 of the workbook. Can anyone help?
Code:
Sub MyFileNameArray()
Dim wb As Workbook
Dim wbs As Workbooks
Set wbs = Application.Workbooks
For Each wb In wbs
Worksheets("Sheet2").ListBox2.AddItem wb.Name
Next wb
End Sub
Last edited by a moderator: