简体   繁体   中英

Identify Shared mailbox name

I have two mailboxes and I want a message box to identify the mailbox every time I use the 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

When I run the code, it has no error but the message box didn't show.

I already got it.

For other's reference, here's the solution. Just add the code below.

Option Explicit
Private WithEvents oItem As MailItem
Private Sub oItem_Reply(ByVal Response As Object, Cancel As Boolean)
MsgBox (oItem.Parent.store)

It works! :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM