excel-vba Print the name of the first object


Example

enter image description here

Option Explicit

Sub CheckWorksheetsDiagram()

    Debug.Print Worksheets(1).Name
    Debug.Print Charts(1).Name
    Debug.Print Sheets(1).Name

End Sub

The result:

Sheet1
Chart1
Chart1