|
||||
These pages are no longer updated and are only available for archive purposes.Click here to visit the pages with updated information. Delete a moduleWhen you want to delete a module by code, you can use the macro below: Sub DeleteVBComponent(ByVal wb As Workbook, ByVal CompName As String) ' requires a reference to the Microsoft Visual Basic Extensibility library ' deletes the vbcomponent named CompName from wb Application.DisplayAlerts = False On Error Resume Next ' ignores any errors wb.VBProject.VBComponents.Remove wb.VBProject.VBComponents(CompName) ' delete the component On Error GoTo 0 Application.DisplayAlerts = True End Sub Example: DeleteVBComponent ActiveWorkbook, "TestModule"
Document last updated 2000-02-05 12:51:07 Printerfriendly version
|
||||
|