【发布时间】:2012-01-29 00:28:06
【问题描述】:
我正在尝试将电子邮件从一个 pst 移动到另一个。
来自here 的示例代码。
代码的重要部分,移动消息:
If objVariant.Class = olMail Or objVariant.Class = olMeetingRequest Then
' This is optional, but it helps me to see in the
' debug window where the macro is currently at.
Debug.Print objVariant.SentOn
' Calculate the difference in years between
' this year and the year of the mail object.
intDateDiff = DateDiff("yyyy", objVariant.SentOn, Now)
' Only process the object if it isn't this year.
If intDateDiff > 0 Then
' Calculate the name of the personal folder.
strDestFolder = "Personal Folders (" & _
Year(objVariant.SentOn) & ")"
' Retrieve a folder object for the destination folder.
Set objDestFolder = objNamespace.Folders(strDestFolder).Folders("Inbox")
' Move the object to the destination folder.
objVariant.Move objDestFolder
' Just for curiousity, I like to see the number
' of items that were moved when the macro completes.
lngMovedMailItems = lngMovedMailItems + 1
' Destroy the destination folder object.
Set objDestFolder = Nothing
End If
现在,问题是,当它移动到目标文件夹时,只有邮件标题可见,邮件正文在 MS Outlook 中变为空白。
我想通过显示移动电子邮件之前和移动电子邮件之后的图像来更好地了解我在说什么。
经过进一步调查,我发现邮件大小保持不变,但 MS Outlook 无法显示该邮件的正文。
当我通过拖放或复制粘贴手动移动消息时,消息仍然正常。我可以看到消息正文。
【问题讨论】:
-
现在就发布这些截图吧!
-
我没有尝试创建自己的 PST 文件,也没有尝试使用
Move将消息复制到其中,因此您的问题是试验的借口。我无法复制您报告的问题。您是否尝试过通过 VBA 访问目标文件夹中的正文?它们是否缺少或充满了无法显示的字符?