I have a fairly simple form with several comboboxes to allow users to tell me specifically what records they need to have updated. (Small part of a ticketing system)
First there is a FileDialog button so they can select their Excel file.
Then the next combo is populated by just reading each of the worksheet names in that file.
Now I need one that will be a list of all the headers (Row1) on that selected worksheet.
Here is what I did for the worksheets, it's very simple. I'd like to do something along these lines for the column headers but I can't seem to figure it out.
Honestly I'm having a hard time even coming up with a starting point though that could just be a Monday morning issue!
Appreciate any help!
First there is a FileDialog button so they can select their Excel file.
Then the next combo is populated by just reading each of the worksheet names in that file.
Now I need one that will be a list of all the headers (Row1) on that selected worksheet.
Here is what I did for the worksheets, it's very simple. I'd like to do something along these lines for the column headers but I can't seem to figure it out.
Honestly I'm having a hard time even coming up with a starting point though that could just be a Monday morning issue!
Appreciate any help!
Code:
Public Function ReadSheetNames()
Dim objExc As Object
Dim objWbk As Object
Dim objWsh As Object
Dim i As Long
Me.SelectScriptWorksheet_cmbo.Clear
Set objExc = CreateObject("Excel.Application")
Set objWbk = objExc.Workbooks.Open(ScriptFile_box)
For Each objWsh In objWbk.Sheets
SelectScriptWorksheet_cmbo.AddItem objWsh.Name
Next
Set objWsh = Nothing
objWbk.Close
Set objWbk = Nothing
objExc.Quit
Set objExc = Nothing
End Function