Man thats a tough request. So i need to recap for everyone:
1 Basically you just want to set your combo box equal to all the names of the excel spreadsheets inside your workbook right?
Now as far as filling out the combo box, I would recommend an array. Something like this this also includes the excel piece you requested.
-
-
Function get_spreadsheetName()
-
-
Public objapp As Excel.Application
-
Public objbook As Excel.Workbook
-
Public objsheet As Excel.Worksheet
-
dim myarray as string
-
dim i, y as integer
-
i = 0
-
-
'Delcare file path where workbook is stored
-
Filepath = FileLocation
-
-
Set objbook = Workbooks.Add(Template:=Filepath) 'Your excel spreadsheet file goes here
-
Set objapp = objbook.Parent
-
-
Y = objapp.ActiveWorkbook.Worksheets.Count
-
-
For i = 1 To Y
-
Set oSheet = objapp.ActiveWorkbook.Worksheets(i)
-
sheetName = oSheet.name
-
Redim myarray(i)
-
-
myarray(i) = SheetName
-
-
Next i
-
-
cmbList.RowSource = "" 'clears the list inside your combo box
-
-
For i = 1 To Y
-
strRowSource = strRowSource & MyArray(i) & ";"
-
Next i
-
-
cmbList.RowSource = strRowSource
-
-
end function
-
Note i have not tested this but I think this is what you want. You need to study up on the Excel object library to understand how this works.
Hello friends,
i have a situation where i have to take the values of combo box from the program. how can i do that.
Let me explain in detail...
i have a form which imports value from a excel sheet which can contain n number of worksheets in it. So when i select a particular excel i should open a combo box which get the names of all the worksheet it contains. Can any body help me out..... Thanks in advance