I have an excel "Closed.Xls" which is not opened currently.
Please let me know how to add new sheets in to this closed excel file. I know how to add new sheets in current excel.
Dim WS as Worksheet
Set WS = Sheets.Add
Please let me know how to
- add new sheets in a closed excel using VBA, and
- get the name of the sheet added
Note: I don't want to rename the sheet.
Thanks
Something like this will will do what you want. It is not possible without opening the workbook but if you turn off screen updating it gives the appearance of not being opened.
To get the sheet name use a
worksheet
variable, ieIt is possible to add a sheet without opening the workbook by using the Microsoft.ACE.OLEDB.12.0 provider:
This will add a heading "ID" to cell A1 of the new sheet. You can probably find a way to delete/change it if necessary.