I have a problem I just cant understand.
This code has worked for me about 6 months now, and I havent done ANY changes at all to it. Can any of you guys think of a reason why it wont work?
The following is just en excerpt of the entire code, but the only thing thats relevant.
'Just the sub start and a few more dim above, no actual running code. Set olApp = CreateObject("Outlook.Application") Set olNameSpace = olApp.GetNamespace("MAPI") 'I've had to change the names of the mappings here because of company security policy. The names are correct thou. Checked them about 20 times now. Set olFolder = olNameSpace.Folders("PST-file mapped in Outlook") Set olInbox = olFolder.Folders("Inbox") Set olStats = olInbox.Folders("Subfolder1") Set olReports = olStats.Folders("The folder with the mails I want.") Sheets("SR").Select 'This sheet holds the data from the last workingday before this one. Copied in manually, so its there, and correct. FirstDate = Cells(2, 9) x = 2 Do While Not Cells(x, 9).Value = Empty x = x + 1 Loop x = x - 1 LastDate = Cells(x, 9).Value i = 2 On Error Resume Next For Each MItem In olReports.Items TmpDate1 = MItem.ReceivedTime 'This one is always empty now for some reason. I´m not getting a date or time. TmpSub = MItem.Subject 'This one work on the other hand. If (TmpDate1 > (FirstDate)) And (TmpDate1 < (LastDate + 1)) Then 'This is where I handle the email if its in the right daterange and so on. Error occurs before this, so its not relevant.
Ok. As you might see here I have a mystery on my hands. The mails are found but without the recievedtime.
Anyone knows what this can be?
And as I said before. This code has worked without a problem for about 6 months now.