下面的代码能够从 Zip 文件中删除文件夹。
Sub del_fol_from_Zip()
CreateObject("Shell.Application").Namespace("C:\Users\mohit.bansal\Desktop\Test\test\first.zip\first\second").Self.Verbs.Item(4).DoIt
End Sub
Link with the Sample Zip
我尝试使用
Application.DisplayAlerts
但这仅涵盖 Excel 应用程序创建的警报。所有的谷歌结果都与 Excel 警报有关,并且没有关于 Windows 警报的信息。我找到了这个链接,但它是针对 Powershell 的。 Link谈路过
$confirm
或 Force
超越警告。Main Question
我们可以通过以上行中的任何参数或其他方式使用
Shell
来超越错误吗? ?
最佳答案
只需使用 RmDir
,它不会导致弹出窗口警报:
Sub DeleteTest()
RmDir "path to the catalog"
End Sub
关于excel - 如何使用 VBA 超越 Windows 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57567452/