Finding the Name on an Excel WorkSheet.
Posted on 2000-02-23
I am working on a program that is importing data from Excel. I have the user select a worksheet, and the the import begins, the problem I have is that the worksheet name are a bit different. When I access the worksheet via:
Set ExcelApp = New Excel.Application
ExcelApp.Visible = True
Set ExcelBook = ExcelApp.ActiveWorkbook
Set ExcelSheet = ExcelBook.Worksheets(1)
This gives me the last active worksheet, but I get back bad data.
Now if the sheet was named "QTR1 99" then I can set
Set ExcelSheet = ExcelBook.Worksheets("QTR1 99") and the data comes out fine. This is my predicament, The name is alway different, can I programatically obtain a collection of sheets from the Excel Object?
I know this seems confusing, but any help is greatly appreciated.
Thank you in Advance.