vba 自动选择删除工作表而不弹出消息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12383755/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 17:42:20  来源:igfitidea点击:

Automatically choose delete worksheet without message popping up

vbaexcel-vbaexcel

提问by TJLD22

I wrote vba code to delete a sheet permanently. When i run it, comes up with the following message:

我编写了 vba 代码来永久删除工作表。当我运行它时,出现以下消息:

"Data may exist in the sheet(s) selected for deletion. To permanently delete the data, press Delete."

“数据可能存在于选择删除的工作表中。要永久删除数据,请按删除。”

How can i write this code so that it deletes the worksheet automatically without the message popping up?

我如何编写此代码以便它自动删除工作表而不弹出消息?

ThisWorkbook.Sheets("SVT").Delete

回答by assylias

You can use:

您可以使用:

Application.DisplayAlerts = False
ThisWorkbook.Sheets("SVT").Delete
Application.DisplayAlerts = True