我有一个代码,其中提供了除邮箱名称以外的电子邮件详细信息。
我有2个邮箱名称,并且每次使用message box
时都希望有一个Reply Action
。
Option Explicit
Dim WithEvents AVDEMAL As Outlook.Folder
Dim avdEMAILmoved As Outlook.Folder
Dim avdEMAILolns As Outlook.NameSpace
Private Sub Application_Startup()
Set avdolns = Application.GetNamespace("MAPI")
Set AVDAVDEMAIL = avdAVDEMAILolns.Folders("AVDAVDEMAIL").Folders("Inbox")
end sub
Private Sub oItem_Reply(ByVal Response As Object, Cancel As Boolean)
If Application.GetNamespace("MAPI") = "AVDAVDEMAIL" Then
MsgBox " hello , You are using AVD-EMAIL"
end if
end sub
运行代码时,它没有错误,但即使使用正确的邮箱也没有显示消息框。
答案 0 :(得分:0)
我已经知道了。
供其他参考,以下是解决方案。只需在下面添加代码即可。
Option Explicit
Private WithEvents oItem As MailItem
Private Sub oItem_Reply(ByVal Response As Object, Cancel As Boolean)
MsgBox (oItem.Parent.store)
有效! :)