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 = "(e-mail address removed)" Then

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

End If

Next
 
G

Guest

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 :-(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top