Hallo!
Ich habe ein VBA Skript für Outlook 365 gesucht, das mir aus selektierten E-Mails die Anhänge in einen bestimmten Ordner abspeichert und anschließend die Anhänge aus dieser E-Mail entfernt. Das funktioniert insofern gut, als dass die Anhänge tatsächlich abgespeichert werden. In Outlook hat die E-Mail aber nach wie vor das "Büroklammer"-Symbol, das symbolisch für "E-Mail mit Anhang" steht und auch die Dateigröße dieser E-Mail hat sich laut Anzeige nicht geändert. Öffne ich allerdings diese E-Mail, sind die Anhänge nicht mehr da bzw. zumindest nicht sichtbar.
Hier das Makro:
Sub Anhang()
Dim FilePath As String
Dim OutlookApp As New Outlook.Application
Dim OutlookExpl As Outlook.Explorer
Dim OutlookSelect As Outlook.Selection
Dim Mail, Anhang As Object
FilePath = InputBox("Speicherort", "Anhänge Speichern unter: ", "C:\Anhaenge\")
On Error Resume Next
Set OutlookExpl = OutlookApp.ActiveExplorer
Set OutlookSelect = OutlookExpl.Selection
For Each Mail In OutlookSelect
Set Anhang = Mail.Attachments
If Anhang.Count <> 0 Then
For i = 1 To Anhang.Count
Anhang(i).SaveAsFile FilePath & Anhang(i).DisplayName
Next i
While Anhang.Count <> 0
Anhang.Remove 1
Wend
Mail.Save
End If
Next
Set Mail = Nothing
Set Anhang = Nothing
Set OutlookApp = Nothing
Set OutlookExpl = Nothing
Set OutlookSelect = Nothing
Resume
End Sub
Kann mir bitte jemand das Verhalten von Outlook erklären? E-Mail ohne Anhang, allerdings als mit solchem gekennzeichnet und mit unveränderter Dateigröße? Vielen Dank im Voraus!
|