功能:刪除 workbook 的 vba 巨集
Sub DelMacro()
'刪除程式碼
For Each OJB In ActiveWorkbook.VBProject.VBComponents
If OJB.Type <> 100 Then
ActiveWorkbook.VBProject.VBComponents.Remove OJB
Else
OJB.CodeModule.DeleteLines 1, OJB.CodeModule.CountOfLines
End If
Next
'刪除宏表
For Each Nx In ActiveWorkbook.Excel4MacroSheets
Nx.Delete
Next
End Sub
沒有留言:
張貼留言