• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

No prompt before delete

I have a couple of lines of code that delete the default sheets from the workbook that my application creates.

        Dim DeadSheet As Worksheet
        DeadSheet = xlBook.Sheets("Sheet1")
        DeadSheet.Delete()
        DeadSheet = xlBook.Sheets("Sheet2")
        DeadSheet.Delete()
        DeadSheet = xlBook.Sheets("Sheet3")
        DeadSheet.Delete()

When the users run the program, they are prompted before deleting each sheet.  Is there a way to skip this prompting to speed up the process?

0
lgropper
Asked:
lgropper
1 Solution
 
bruintjeCommented:
Hello lgropper,

assuming you declared your xl app earlier, you can use something like
---------
xlApp.ScreenUpdating = false
xlApp.DisplayAlerts = false

        Dim DeadSheet As Worksheet
        DeadSheet = xlBook.Sheets("Sheet1")
        DeadSheet.Delete()
        DeadSheet = xlBook.Sheets("Sheet2")
        DeadSheet.Delete()
        DeadSheet = xlBook.Sheets("Sheet3")
        DeadSheet.Delete()

xlApp.DisplayAlerts = true
xlApp.ScreenUpdating = true
---------

hope this helps a bit
bruintje
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now