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
Thanks Jim :)