M
Manuel Graumann
Hi folks!
I'm automating the deletion of some Junk-Mails using this code:
Private Sub Delete_Junk()
Dim objPosteingang As MAPIFolder
Dim objNewMail As MailItem
Set objPosteingang =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
For Each objNewMail In objPosteingang.Items
'(...)
Next
Set objPosteingang = Nothing
End Sub
If I receive a MeetingItem, which is usually an item of the specified
folder, the code stops with an error.
I already found out, that it happens at "for each..." but WHY?
I thought this can't happen as objNewMail is defined as MailItem and not
simply as Item?!
Yes, I could write some workaround for myself but that's not the point I'm
after.
If anybody could give me some more insight into this matter, I'd appreciate
it.
Regards
Manuel
I'm automating the deletion of some Junk-Mails using this code:
Private Sub Delete_Junk()
Dim objPosteingang As MAPIFolder
Dim objNewMail As MailItem
Set objPosteingang =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
For Each objNewMail In objPosteingang.Items
'(...)
Next
Set objPosteingang = Nothing
End Sub
If I receive a MeetingItem, which is usually an item of the specified
folder, the code stops with an error.
I already found out, that it happens at "for each..." but WHY?
I thought this can't happen as objNewMail is defined as MailItem and not
simply as Item?!
Yes, I could write some workaround for myself but that's not the point I'm
after.
If anybody could give me some more insight into this matter, I'd appreciate
it.
Regards
Manuel