How do you list teh names of the worksheets?

kenmasters
04-01-2003, 05:07 AM
Hi,

I need to know how to list the names of the worksheets in an excel file using VB6.0.
I can open them using excel.Sheets("Sheet name").Select but I need to list them in my app...

Please help me!

icjackson
04-01-2003, 05:23 AM
The following will look at every sheet in the activebook and put the append the name of the sheet to a string... naturally, you can change this to an array or list box or whatever.
Dim shtSheet As Worksheet
Dim strSheetNames As String
For Each shtSheet In ActiveWorkbook.Worksheets
strSheetNames = strSheetNames & shtSheet.Name & Chr$(13)
Next shtSheet
MsgBox strSheetNames

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum