Hi, i'm calling a userform that is being populated with data from another workbook. The code opens the sourcebook and keeps it in read-only modus until i close the userform which is fine. However it seems that this prevents me from setting my userform to vbmodeless! I tried false true app.enableevents but to no avail.. Below is the Initialize event of the form. Does anybody have any idea to fix this? Thank you very much!
Private Sub UserForm_Initialize()
Dim ListItems As Variant, i As Integer
Application.EnableEvents = False
Application.ScreenUpdating = False
With Me.ComboBox1
Application.ScreenUpdating = False
Set SourceWB = Workbooks.Open("E:\Hangar\Sheet2.xlsm", _
False, True)
ListItems = SourceWB.Worksheets("Parts").Range("A2:A10000")
ListItems = Application.WorksheetFunction.Transpose(ListItems)
For i = 1 To UBound(ListItems)
.AddItem ListItems(i)
Next i
.ListIndex = 0
End With
Application.EnableEvents = True
Exit Sub
End Sub
Bookmarks