verify and delete mailitem
Michael
(Sorry about the double post - I accidently started a new thread for
this and decided to send it to the original thread.)
I just thought I should learn more about text parsing for future
projects since I came across it. Actually I wish I had more time to
noodle around with programming MSOffice instead of working in it.
Programming appeals to my love of puzzles.
I am having a problem with my little macro you helped me with.
Here it is in full:
Public Sub Deletions()
Dim obj As Object
Dim Items As Outlook.MailItem
Set Items = Application.Session.GetDefaultFolder(olFolderInbox ).Items
Dim i As Long
For i = Items.Count To 1 Step -1
Set obj = Items(i)
If InStr(1, obj.Body, "Description: Successful", vbTextCompare)
Then
obj.Delete
End If
Next
End Sub
I suspect that I don't have the beginning of the procedure correct.
The error I am getting is on the set items = line
The error is Run time error #13 Type Mismatch
Do I even need the set items statement here?
I am in the inbox when I run the macro, so maybe it isn't necessary
to tell the macro where to find the items?
Object, Items and long have all been dimmed - they are the only
variables in the procedure, so I know that is okay.
You created the loop so I know that's good to go.
Thanks for your help again - Someday maybe I can get these little
things done without needing my hand held so much ;-)
Joanne
Michael Bauer wrote:
Am Sun, 11 Jun 2006 12:12:24 GMT schrieb Joanne:
Thanks, Joanne. But itīs no magic, for most of us developing software is the
job for many years.
"Parsing text" gives a lot of results. If you do have a link maybe I can
tell more about that function.
But why donīt you like the InStr function?
|