Re: Problem with GetItemFromID
From: Wolfram Jahn (wjng_at_kirchweg.de)
Date: 03/14/05
- Previous message: cybnblau: "How do I create a macro to insert text in an email?"
- In reply to: m|sf|t: "Re: Problem with GetItemFromID"
- Next in thread: Wolfram Jahn: "Re: Problem with GetItemFromID"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 14 Mar 2005 22:22:49 +0100
ok, this one deletes at once without any question,
################
so be careful!!!
################
You will need a reference to the Microsoft CDO 1.2 Library.
---
Public Sub del_msg(subjectPart)
Dim ibx As MAPIFolder, msg, i, arr, itm As MailItem, mId, oNs As
NameSpace, sep
Dim ses As MAPI.Session
Dim mbx As MAPI.Folder
Dim mms As MAPI.Message
Set ses = CreateObject("MAPI.Session")
ses.Logon
Set mbx = ses.Inbox
msg = ""
sep = ""
Set oNs = Application.GetNamespace("MAPI")
Set ibx = oNs.GetDefaultFolder(olFolderInbox)
For i = ibx.Items.Count To 1 Step -1
If ibx.Items(i).MessageClass = "IPM.Note" Then
If InStr(1, ibx.Items(i).Subject, subjectPart) = 1 Then
msg = msg & sep & ibx.Items(i).EntryID
sep = " "
End If
End If
Next i
If msg <> "" Then
arr = Split(msg)
For Each mId In arr
Set mms = ses.GetMessage(mId, mbx.StoreID)
mms.Delete
Next mId
End If
End Sub
- Previous message: cybnblau: "How do I create a macro to insert text in an email?"
- In reply to: m|sf|t: "Re: Problem with GetItemFromID"
- Next in thread: Wolfram Jahn: "Re: Problem with GetItemFromID"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|