其他分享
首页 > 其他分享> > VBA删除代码

VBA删除代码

作者:互联网

Sub compact_code()

On Error Resume Next
    Dim Element As Object
    For Each Element In ActiveWorkbook.VBProject.VBComponents
        ActiveWorkbook.VBProject.VBComponents.Remove Element
    Next

End Sub

这将删除所有模块,包括 ClassModules 和 UserForms,但保留所有对象模块(工作表、工作簿). 

标签:ActiveWorkbook,VBA,Sub,删除,代码,Next,VBComponents,Element,VBProject
来源: https://www.cnblogs.com/luoye00/p/16373070.html