![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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? -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- Michael I was cracking my brain on this all day yesterday and here you make it just a short and sweet few lines. Excellent!! I thank you for your time. I spent considerable time at outlookcode.com yesterday and found something called parsing text that looks at these kind of emails where there is a label: data format and tried writing it up for my own use but failed at it. I am gratefully going to use your loop to do this particular job, but I would like to know if it would be feasible to use the parsing text in a case like this - I know there are many ways to skin the cat in programming, I simply am woefully short on the knowledge to accomplish it. But I do love the hunt - especially when you mvps give us the help we need when we get bottled up. Just reading your groups I pickup so many hints and points in the right direction. Better than a classroom any day! Thanks again Joanne Michael Bauer wrote: Am Sat, 10 Jun 2006 18:17:30 GMT schrieb Joanne: Joanne, ThisOutlookSession is a good place for the code. For being able to delete items you need a backward loop. Outlook´s Selection object doesn´t know a Find method, instead you can use the Instr function: 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 Endif Next Your loop handles all the items in the folder - again and again. If you have another mechanism to clean up that folder then that´s ok. If instead the folder´s content grows more and more then you´ll probably wish a faster way to loop through the unhandled items only. |
#2
|
|||
|
|||
![]()
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? |
#3
|
|||
|
|||
![]()
Am Mon, 12 Jun 2006 13:08:44 GMT schrieb Joanne:
Joanne, that error tells you there´s a mismatch between both the data types of the variable and the property you´re trying to pass to it. So please dim Items As Outlook.Items instead of MailItem. If you´re in doubt you can check it simply yourself: You set the variable to the Items object in the Set Items = ... line. You can point the mouse over ..Items and right click "QuickInfo". That´ll display a tooltip which tells you what kind of data type it is. If you´re in the correct folder for sure then you could skip the GetDefaultFolder function and use Application.ActiveExplorer.CurrentFolder instead. But I´d suggest to use GetdefaultFolder, that makes your code more independant. You´re welcome. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- 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? |
#4
|
|||
|
|||
![]()
Thanks for the info Michael - the macro now works really sweet.
Didn't know about the "quickinfo" so feel like I got extra instruction on this one. Will use it to make life easier next time I venture into Outlook programming. Joanne Michael Bauer wrote: Am Mon, 12 Jun 2006 13:08:44 GMT schrieb Joanne: Joanne, that error tells you there´s a mismatch between both the data types of the variable and the property you´re trying to pass to it. So please dim Items As Outlook.Items instead of MailItem. If you´re in doubt you can check it simply yourself: You set the variable to the Items object in the Set Items = ... line. You can point the mouse over ..Items and right click "QuickInfo". That´ll display a tooltip which tells you what kind of data type it is. If you´re in the correct folder for sure then you could skip the GetDefaultFolder function and use Application.ActiveExplorer.CurrentFolder instead. But I´d suggest to use GetdefaultFolder, that makes your code more independant. You´re welcome. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Restricted access; verify credentials | BEEP | Outlook - Calandaring | 0 | May 16th 06 03:29 PM |
verify that an email was read without using a receipt | RCNellis | Outlook - General Queries | 1 | May 12th 06 04:02 PM |
Need to verify TO recipient | [email protected] | Outlook - Using Forms | 2 | April 19th 06 10:38 PM |
how do you verify credentials | roger | Outlook - Calandaring | 1 | March 2nd 06 04:13 PM |
How can I create a MailItem that displays like a received MailItem ? | Clive | Outlook - Using Forms | 0 | February 27th 06 04:14 PM |