I have 2 workbooks test1 (has 3 sheets) and tests(has 1 sheet).
In tests I have a combo box named ComboBox1.I have to add the name of the sheets from workbook test1 in this ComboBox1.
I have written the following code
Sub Workbook_open()
Dim sht As Worksheet
Set wkbSource = Workbooks.Open("test1.xls")
For Each sht In wkbSource.Worksheets
ActiveWorkbook.Worksheets(1).ComboBox1.AddItem sht.Name
Next sht
End Sub
It is giving me an error
ERROR : Object doesn't support this property or method on line ActiveWorkbook.Worksheets(1).ComboBox1.AddItem sht.Name
How can I fix it ?