PDA

View Full Version : Code to select current open workbooks under ComboBox n Userform



Valerian
07-28-2015, 04:13 PM
Hi Friends,

I am completely new to coding in vba. I have currently written the below code for selecting workbook to be used for running the macro. However even though the workbooks are open I do not see it under the combobox drop down. Could you please suggest what needs to be done in order to be able to see the current open workbooks under the combobox drop down.


Option Explicit

Private Sub ComboBox1_Change()
With ComboBox1
Label1.Caption = "Fees Template"
End With
Dim Wkbk As Workbook

Wkbk = FeesTemplate("csv files, *.csv")
If Wkbk = False Then MsgBox "Please select the correct File"
Else
Private Sub ComboBox2_Change()
With ComboBox2
Label2.Caption = "Formatted"
End With
Dim Wkbk As Workbook

Wkbk = Formatted("csv files, *.csv")
If Wkbk = False Then MsgBox "Please select the correct File"
End If
End If
End Sub
End Sub