![]() |
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
|
|||
|
|||
![]()
I am running code that exports data releated to unread messages in an inbox.
What is puzzling me is that the code only returns half of the values that it is supposed to. For example, if I have 50 unread messages, it will export the data on the first 25 and stop. Any ideas what is causing this? I am running OL 2003 on Windows XP Pro. Sub SupplierSurvey() With Application.Session ExportMessageDetails .Folders("Mailbox - Quality Department").Folders("Inbox") End With End Sub Function ExportMessageDetails(vFolder As MAPIFolder) As Boolean On Error GoTo Err_Handler Kill "H:\SupplierSurvey.txt" Dim vItem As Object, vFF As Long, vFile As String vFF = FreeFile vFile = "H:\SupplierSurvey.txt" For Each vItem In vFolder.Items If TypeName(vItem) = "MailItem" Then If vItem.UnRead Then Open vFile For Append As #vFF Print #vFF, vFolder.Name & vbTab & Format(vItem.ReceivedTime, "mm/dd/yyyy hh:mm:ss") Close #vFF End If End If Next Err_Handler: Resume Next End Function Thanks! PJ |
Ads |
#2
|
|||
|
|||
![]()
Strange. See what happens if you temporarily move 30 of those messages to
another folder and run your code again. Also, remove the error handling so if any errors do occurr you'll know right away. -- Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "PJFry" wrote: I am running code that exports data releated to unread messages in an inbox. What is puzzling me is that the code only returns half of the values that it is supposed to. For example, if I have 50 unread messages, it will export the data on the first 25 and stop. Any ideas what is causing this? I am running OL 2003 on Windows XP Pro. Sub SupplierSurvey() With Application.Session ExportMessageDetails .Folders("Mailbox - Quality Department").Folders("Inbox") End With End Sub Function ExportMessageDetails(vFolder As MAPIFolder) As Boolean On Error GoTo Err_Handler Kill "H:\SupplierSurvey.txt" Dim vItem As Object, vFF As Long, vFile As String vFF = FreeFile vFile = "H:\SupplierSurvey.txt" For Each vItem In vFolder.Items If TypeName(vItem) = "MailItem" Then If vItem.UnRead Then Open vFile For Append As #vFF Print #vFF, vFolder.Name & vbTab & Format(vItem.ReceivedTime, "mm/dd/yyyy hh:mm:ss") Close #vFF End If End If Next Err_Handler: Resume Next End Function Thanks! PJ |
#3
|
|||
|
|||
![]()
Figures it out. What I was trying to do was count the number of unread
items, specifically Undeliverable mail. In this case, exactly half of the messages were undeliverable. The code is supposed to look at MailItems, which I am guessing undeliverable mail is not. Once I cleared those message out, I got the result I was expecting. So that begs the question, what kind of an item is undeliverable mail? "PJFry" wrote: I am running code that exports data releated to unread messages in an inbox. What is puzzling me is that the code only returns half of the values that it is supposed to. For example, if I have 50 unread messages, it will export the data on the first 25 and stop. Any ideas what is causing this? I am running OL 2003 on Windows XP Pro. Sub SupplierSurvey() With Application.Session ExportMessageDetails .Folders("Mailbox - Quality Department").Folders("Inbox") End With End Sub Function ExportMessageDetails(vFolder As MAPIFolder) As Boolean On Error GoTo Err_Handler Kill "H:\SupplierSurvey.txt" Dim vItem As Object, vFF As Long, vFile As String vFF = FreeFile vFile = "H:\SupplierSurvey.txt" For Each vItem In vFolder.Items If TypeName(vItem) = "MailItem" Then If vItem.UnRead Then Open vFile For Append As #vFF Print #vFF, vFolder.Name & vbTab & Format(vItem.ReceivedTime, "mm/dd/yyyy hh:mm:ss") Close #vFF End If End If Next Err_Handler: Resume Next End Function Thanks! PJ |
#4
|
|||
|
|||
![]()
If it passes the MailItem test it will be some variation of *.IPM.Note.*.
You can set the folder to a bottom reading pane view and customize the view to see the exact MessageClass. Depending on the server and the source of the message it could really be anything. An undeliverable message that I get from my Exchange server has a MessageClass of "REPORT.IPM.Note.NDR" -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "PJFry" wrote in message ... Figures it out. What I was trying to do was count the number of unread items, specifically Undeliverable mail. In this case, exactly half of the messages were undeliverable. The code is supposed to look at MailItems, which I am guessing undeliverable mail is not. Once I cleared those message out, I got the result I was expecting. So that begs the question, what kind of an item is undeliverable mail? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
CompareEntryIDs is returning bogus results | Count Infinity | Add-ins for Outlook | 4 | October 19th 07 03:19 AM |
Close method returning 80040108 | Michael Tissington | Add-ins for Outlook | 4 | February 14th 07 01:03 AM |
WDS not returning Office 2007 emails on Windows XP | BerkHolz, Steven | Outlook - General Queries | 5 | January 12th 07 08:28 PM |
deleted emails returning | David | Outlook - General Queries | 0 | March 30th 06 06:09 PM |
Old Reminders Keep Returning | Anita Taylor | Outlook - Calandaring | 0 | March 9th 06 04:11 PM |