Excel のマクロを消すマクロを書こうと思ったら、警告が出ました。
マクロはこんな感じです。
こちらのページ「VBAでマクロのソース削除と標準モジュール削除」を参照させていただきました。
Dim objVBCOMPO As Object
For Each objVBCOMPO In ActiveWorkbook.VBProject.VBComponents
With objVBCOMPO.CodeModule
If .CountOfLines <> 0 Then .DeleteLines 1, .CountOfLines
End With
If (objVBCOMPO.Type = vbext_ct_StdModule Or objVBCOMPO.Type = vbext_ct_MSForm) Then
ActiveWorkbook.VBProject.VBComponents.Remove objVBCOMPO
End If
Next objVBCOMPO
Set objVBCOMPO = Nothing
End Sub
これをデフォルトの設定で走らせると警告が出ます。
これは、マクロセンターの Trust access to the VBA project object model オプションをオンにすると動くようになります。