Hi guys, is there a way to get worksheet names from a close workbook? thanks for any help.

I presume you mean an Excel Workbook/Worksheet. As far as I know you have to open it first but you can do that easily with the following function

Private Function GetWorkSheetNames(ByVal ExcelFile As String) As String()

    Dim names As String = ""
    Dim xls As New Excel.Application
    xls.Workbooks.Open(ExcelFile)

    For Each sheet As Excel.Worksheet In xls.ActiveWorkbook.Worksheets
        names = names & vbCr & sheet.Name
    Next

    xls.Quit()

    Return names.Substring(1).Split(vbCr)

End Function
commented: Thanks. +8

Thanks Jim :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.