如果conversationID与请求相同,我遍历MailItem集合以显示MailItem。
然而,似乎是,当搜索的项目不在ActiveSelection上并且调用了MailItem.Display函数时,它会产生'运行时错误-2147467259'
Outlook无法执行此操作,因为对话框已打开。请关闭它并再试一次。
这是代码
' email_link_Click() '
' -> Compares the ConversationID sent through to get the email '
Sub email_link_Click()
Dim searchFolder As Object
Set olNs = Application.GetNamespace("MAPI")
Set olFldr = olNs.GetDefaultFolder(olFolderInbox)
Set searchFolder = olFldr
If Not Me.email_folder.Caption = "Inbox" Then
Set searchFolder = olFldr.Folders(Me.email_folder.Caption)
End If
searchFolder.Items.Sort "[Subject]", False
For Each emailvar In searchFolder.Items
If emailvar.ConversationID = Me.conversationID_label.Caption Then
FilingPrint ("Found email - Opening..")
emailvar.Display '<- Error is created from here
Exit Sub
End If
Next emailvar
Set searchFolder = Nothing
End Sub
这是因为它无法一次查看两封电子邮件吗?
答案 0 :(得分:0)
所以最后问题是我有效打开了2个视图实例。我没有花太多时间在上面,而是创建了一个看起来像电子邮件视图的用户表单,并从已解析的MailItem对象中提取了详细信息。