Hallo liebe VBA Gemeinde
Ich habe mal wieder eine Frage und wäre froh um Expertenhilfe:
Ich möchte mittels Code alle Codes aus allen Outlook Modulen in ein Excelfile schreiben und speichern.
Dabei brauche ich den richtigen Zugriff auf das Outlook Projekt. Das will irgendwie nicht hinhauen.
Dim olApp As Object
Dim olNamespace As Object
Dim olVbaProject As Object
Dim olVBComponent As Object
Dim olCodeModule As Object
' Outlook via Late Binding starten
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If olApp Is Nothing Then
MsgBox "Outlook ist nicht geöffnet.", vbExclamation
Exit Sub
End If
On Error GoTo 0
' Outlook VBA Projekt laden
On Error Resume Next
Set olVbaProject = olApp.VBE.VBProjects(1) ' Zugriff auf das Outlook VBA Projekt => Hier kommt die Fehlermeldung, da OlVbaProject leer bleibt. Wie muss ich den Zugriff richtig ansteuern?
If olVbaProject Is Nothing Then
MsgBox "Kein Zugriff auf das Outlook-VBA-Projekt. Bitte aktivieren Sie den Zugriff in den Sicherheitseinstellungen.", vbExclamation
Exit Sub
End If
Laut Microsoft liegt es an den Makroeinstellungen. Das stimmt aber nicht. Ist alles eingeschaltet.
Gruss
|