Outlook 2019-VBA Makro-Email mit Datum und Uhrzeit speichern

Dieser Thread ist Teil einer Diskussion zu einem Artikel:  Zum News-Artikel gehen

41-Da

Neues Mitglied
Liebe Community,

bis gestern nutzte ich ein VBA-Makro in Outlook 2016?, um automatisch Mails mit Datum, Uhrzeit etc. in einen bestimmten Ordner zu speichern.
Das hat über Monate prima funktioniert.
Gestern wurde Outlook auf 2019 upgedatet und das Makro funktioniert nicht mehr.

Das Makro ist/war das folgende:

C-ähnlich:
Sub SaveEmail()
Dim strPath As String
Dim strText As String
 
strPath = Environ("USERPROFILE") & "\Documents\1-Eigene\P-Abt41\Email"
 
  If TypeOf Application.ActiveWindow Is Outlook.Explorer Then
  Set obj = Application.ActiveWindow
  Set obj = obj.Selection(1)
 
  Else
 
   Set objInspector = ActiveInspector
   objInspector.Activate
 
      If objInspector.IsWordMail Then
         Set obj = Application.ActiveInspector.CurrentItem
      End If
 
  End If
  
  
  
With obj
    strText = Replace(.Subject, "/", "_")
    strText = Replace(strText, "!", "")
    strText = Replace(strText, ".", "_")
    strText = Replace(strText, "\", "_")
    strText = Replace(strText, ":", "_")
    strText = Replace(strText, "(", "")
    strText = Replace(strText, ")", "")
    strText = Replace(strText, """", "")
  
  
.SaveAs strPath & Format(.ReceivedTime, "YYYY-MM-DD-hhmm") & "-E-A-I" & .Sender & "-" & .To & "-" & strText & ".msg", olMSG
End With
 
 
End Sub

Jetzt kommt ein Laufzeitfehler und der Debugger markiert die .SaveAs-Zeile:

C-ähnlich:
.SaveAs strPath & Format(.ReceivedTime, "YYYY-MM-DD-hhmm") & "-E-A-I" & .Sender & "-" & .To & "-" & strText & ".msg", olMSG

Hat einer von Euch eine Idee, woran das liegen könnte?

Vielen Dank und viele Grüße

Alex
 
Zuletzt bearbeitet von einem Moderator:
Oben