Skip to content

Instantly share code, notes, and snippets.

@ErhardRainer
Created November 14, 2023 14:05
' Subroutine zum Durchgehen der Elemente in einem bestimmten Ordner
Public Sub GetItemsOfFolder(MAPIFolder As Outlook.MAPIFolder)
Dim myEmail As Outlook.MailItem
Dim myObj As Object
Debug.Print "Der Ordner " & MAPIFolder.FolderPath & " enthält " & MAPIFolder.Items.Count & " Elemente"
' Durchgeht jedes Element im Ordner
For Each myObj In MAPIFolder.Items
' Prüft, ob es sich um eine E-Mail handelt
If TypeName(myObj) = "MailItem" Then
Set myEmail = myObj
Debug.Print " " & myEmail.Subject
End If
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment