Does anybody know the correct code to identify a worksheet name from an Excel file ?. I am writing code to look at each worksheet in an excel file and will loop it through each one during an import.
Code I have so far but this does not work with the worksheet section.
Thanks
Function Main
Set MsExcObj = CreateObject("Excel.Application")
Set wbk = GetObject("J:\Precedent Decisions by country.xls")
Set Wsht = wbk.Worksheets
For Each Wsht In wbk
msgbox wbk.name
Next
Set wbk = Nothing
Set MsExcObj = Nothing
Set Wsht = Nothing
Main = DTSTaskExecResult_Success
End Function