Gruppe
VBE
Problem
Wie kann ich in XL8 über VBA-Code ein VBA-Modul einer zweiten Arbeitsmappe löschen?
StandardModule: basMain
Sub Loeschen()
Dim sFile As String
Application.ScreenUpdating = False
sFile = ThisWorkbook.Path & "\testvbe.xls"
If Dir(sFile) = "" Then
MsgBox "Test-Arbeitsmappe wurde nicht gefunden!"
Else
Workbooks.Open sFile
On Error GoTo ERRORHANDLER
With ActiveWorkbook.VBProject
.VBComponents.Remove .VBComponents("basTest")
End With
End If
Application.ScreenUpdating = True
Exit Sub
ERRORHANDLER:
MsgBox "Modul wurde nicht gefunden!"
Application.ScreenUpdating = True
End Sub