# Excel automation and delete sheet

**URL:** <https://www.dynamicsuser.net/t/excel-automation-and-delete-sheet/5808>\
**Category:** Developers Forum\
**Created:** [March 7, 2002, 9:45pm UTC](https://www.dynamicsuser.net/t/excel-automation-and-delete-sheet/5808 "2002-03-07T21:45:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thaug](https://avatars.discourse-cdn.com/v4/letter/t/43a26b/32.png) [@thaug](https://www.dynamicsuser.net/u/thaug)\
**Post date:** [March 7, 2002, 9:45pm UTC](https://www.dynamicsuser.net/t/excel-automation-and-delete-sheet/5808/1 "2002-03-07T21:45:06Z")

</div>

I have set up an Excel automation routine that works very well thanks to the help of other NOLUG posts that I have read. The problem that I am having now, is that if I pass the command to delete a worksheet, it asks me to confirm that deletion. I would like it to just do it without asking. Any way to do this? Here is the code that I am using: Vars - Name DataType Subtype Length xlApplication Automation ‘Microsoft Excel 9.0 Object Library’.Application xlWorkbook Automation ‘Microsoft Excel 9.0 Object Library’.Workbook xlWorkSheet Automation ‘Microsoft Excel 9.0 Object Library’.Worksheet Code - xlWorkbook := xlApplication.Workbooks.Add; xlSheets := xlWorkbook.Worksheets; xlWorkSheet := xlSheets.Item(‘Sheet3’); xlWorkSheet.Delete;

---

<div class="post-metadata">

**Author:** ![ClausJohnsen](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@ClausJohnsen](https://www.dynamicsuser.net/u/ClausJohnsen)\
**Post date:** [March 8, 2002, 7:25am UTC](https://www.dynamicsuser.net/t/excel-automation-and-delete-sheet/5808/2 "2002-03-08T07:25:02Z")

</div>

You can supress allerts in Excel by setting the DisplayAlerts property on the Aplication object. xlApplication.DisplayAlerts := FALSE; code… xlApplication.DisplayAlerts := TRUE;
