Get sheet name in any workbook

O

OffDev

Hello,

I would like to get the name of the first sheet in any workbook that an user
chooses.
Is this possible?
I've tried wb.sheets(1).name. Doesn't work.

Please assist.
Thanks
 
J

JLGWhiz

Here is one way right out of VBA help file.

For Each sh In Workbooks("BOOK1.XLS").Windows(1).SelectedSheets
If sh.Name = "Sheet1" Then
MsgBox "Sheet1 is selected"
Exit For
End If
Next


You can also try: ActiveSheet.Name
 
Top