0
我想將郵件移動到不同的文件夾,然後將鏈接返回到移動的郵件。如果沒有移動它的工作原理爲:Outlook VBA鏈接到移動的郵件
Dim objMail As Outlook.MailItem
Dim sFrag As String
Set objMail = Application.ActiveExplorer.Selection.Item(i_item)
sFrag = "<a href='outlook:" + objMail.EntryID + "'>" + objMail.Subject + "</a>""
在這裏有串sFrag
在適當的超級鏈接提供了一個有效的Outlook元素。如果我點擊一個包含此屬性的超鏈接,該元素將在Outlook中打開。
但是,如果我這樣擴大到:
Dim objMail As Outlook.MailItem
Dim sFrag As String
Dim oOlApp As Outlook.Application
Dim targetFolder As folder
Set objMail = Application.ActiveExplorer.Selection.Item(i_item)
Set oOlApp = Outlook.Application
Set objNmSpc = oOlApp.GetNamespace("MAPI")
Set targetFolder = objNmSpc.PickFolder
objMail.Move targetFolder
sFrag = "<a href='outlook:" + objMail.EntryID + "'>" + objMail.Subject + "</a>"
後,在sfrag
鏈接失敗。如果我想打開此鏈接,Outlook-Windows將顯示Operation failed
。似乎objMail.EntryID
在objMail.Move
命令後未正確更新。
爲什麼?如何解決這個問題?
沒有工作。感謝你的快速幫助。 – BerndGit