Emoncada
10-29-2012, 09:26 AM
I have the following code that works perfectly, but I need it for 3 Combobox's from 3 different files.
Private Sub Workbook_Open()
Dim F As Integer, FromFile As String
F = FreeFile(1)
ActiveSheet.OLEObjects("CmbModel").Object.Clear
Open "H:\Excel\Data\Models.txt" For Input As #F
Do Until EOF(F)
Line Input #F, FromFile
ActiveSheet.OLEObjects("CmbModel").Object.AddItem FromFile
Loop
Close #F
End Sub
What i was trying is something like this
Private Sub Workbook_Open()
Dim F As Integer, FromFile As String
F = FreeFile(1)
ActiveSheet.OLEObjects("CmbModel").Object.Clear
Open "H:\Excel\Data\Models.txt" For Input As #F
Do Until EOF(F)
Line Input #F, FromFile
ActiveSheet.OLEObjects("CmbModel").Object.AddItem FromFile
Loop
Close #F
Dim G As Integer, FromFile1 As String
G = FreeFile(1)
ActiveSheet.OLEObjects("CmbIssue").Object.Clear
Open "H:\Excel\Data\Issues.txt" For Input As #G
Do Until EOF(G)
Line Input #G, FromFile1
ActiveSheet.OLEObjects("CmbIssue").Object.AddItem FromFile1
Loop
Close #G
End Sub
I would also need to add one more set, any help would be great.
Thanks
Private Sub Workbook_Open()
Dim F As Integer, FromFile As String
F = FreeFile(1)
ActiveSheet.OLEObjects("CmbModel").Object.Clear
Open "H:\Excel\Data\Models.txt" For Input As #F
Do Until EOF(F)
Line Input #F, FromFile
ActiveSheet.OLEObjects("CmbModel").Object.AddItem FromFile
Loop
Close #F
End Sub
What i was trying is something like this
Private Sub Workbook_Open()
Dim F As Integer, FromFile As String
F = FreeFile(1)
ActiveSheet.OLEObjects("CmbModel").Object.Clear
Open "H:\Excel\Data\Models.txt" For Input As #F
Do Until EOF(F)
Line Input #F, FromFile
ActiveSheet.OLEObjects("CmbModel").Object.AddItem FromFile
Loop
Close #F
Dim G As Integer, FromFile1 As String
G = FreeFile(1)
ActiveSheet.OLEObjects("CmbIssue").Object.Clear
Open "H:\Excel\Data\Issues.txt" For Input As #G
Do Until EOF(G)
Line Input #G, FromFile1
ActiveSheet.OLEObjects("CmbIssue").Object.AddItem FromFile1
Loop
Close #G
End Sub
I would also need to add one more set, any help would be great.
Thanks