...165...


Modul per VBA erzeugen
> Bitte einen Verweis setzen auf:
> Microsoft Visual Basic for Application Extensibilty
Sub Modul_anlegen()
  ActiveWorkbook.VBProject.VBComponents.Add (vbext_ct_StdModule)
  Dim txt As String
  txt = "Sub Monika" & Chr(13) & _
        "MsgBox ""Guten Morgen Monika""" & Chr(13) & _
        "End Sub"
  Application.VBE.ActiveCodePane.CodeModule.InsertLines 3, txt
End Sub

 


Modul per VBA löschen
Sub Modul_loeschen()
  With ActiveWorkbook.VBProject
    .VBComponents.Remove .VBComponents("Modul2")
  End With
End Sub

by Bert Körn