I have used the above in my excel file by copying this into visual basic editor.
Actually I want the all woksheets name of my file in a sheet.
Suppose if i have one file named c:\a.xls having four different sheets. Can you please tell me how to apply this code into the file.
I am new to this thing please advice me in full, means i have to just copy the thing which you will give me.
Please write sub () and endsub in this code also so that i can understand in full. Because I have already tried the above but error is coming
Dim mExcel As New Excel.Application, wb As Workbook, ws As Worksheet, YrXlsFilNam As String
YrXlsFilNam = "c:\a.xls"
set mExcel.workbooks.open(YrXlsFilNam) (Error is coming in this line)
For Each ws In wb.Worksheets