VBA: Moving item changes received date to now

  • Thread starter jameshamilton777
  • Start date
J

jameshamilton777

I have simple code that moves messages into another PST file. But each
message moved gets it's received date changed to the current date time
which is useless. Any workarounds? Thanks, James.

Dim objOutlookApplication As Application
Dim objNameSpace As NameSpace
Dim objInbox As MAPIFolder
Dim objMessage As MailItem

Set objOutlookApplication = CreateObject("Outlook.Application")
Set objNameSpace = objOutlookApplication.GetNamespace("MAPI")
Set objInbox = objNameSpace.GetDefaultFolder(olFolderInbox)

For Each objMessage In objInbox.Items

If objMessage.SenderEmailAddress = "[email protected]" Then

objMessage.Move objNameSpace.Folders("Example
Folder").Folders("Subfolder")

End If

Next
 
E

Eric Legault [MVP - Outlook]

Strange, I'm not experiencing that behaviour. Are you sure you're not
looking at the Modified field in the view? That will get timestamped when
the message is moved; all others (Received, Sent, Created) should retain the
original value.
 
J

jameshamilton777

Yes, it is the Received field that is changed. I've seen similar
reports on other forums. I'm using Outlook 2003. Might have something
to do with the email being moved to a separate PST file?
 
D

Dmitry Streblechenko

Is it being moved from an Exchange mailbox to PST? Or from one PST to
another PST?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
J

jameshamilton777

Dmitry said:
Is it being moved from an Exchange mailbox to PST? Or from one PST to
another PST?

It's being moved from one PST to another, both of which are "open" in
my Outlook session.

I know others have seen this problem but it must be rare. Wonder why
I've caught it :-(
 
Top