Removing Default Excel Sheets
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2010
11:12 AM
06-30-2010
11:12 AM
Removing Default Excel Sheets
When creating a new Excel object, it creates 3 default sheets. How do I remove these extra sheets?
xclD = Sys.OleObject("Excel.Application");
workBkDarwin = xclD.Workbooks.Add();
// remove default sheets
workSheetEvent = workBkDarwin.Sheets.Add();
workSheetEvent.Name = "Event";
xclD = Sys.OleObject("Excel.Application");
workBkDarwin = xclD.Workbooks.Add();
// remove default sheets
workSheetEvent = workBkDarwin.Sheets.Add();
workSheetEvent.Name = "Event";
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2010
09:45 PM
06-30-2010
09:45 PM
Hi,
Add the code below at the end of the given code to do what you need:
for(i = 2; i <= workBkDarwin.Sheets.Count; i++) {
workBkDarwin.Sheets.Item(i).Delete();
}
BTW, we provide support only for AutomatedQA products, but not for the Excel object model.
--
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
