Outlook macro - SendUsingAccount - settings error or bug?

  • Thread starter Thread starter vic
  • Start date Start date
V

vic

Hi,

I am using Outlook 2010, and have two mailboxes, individual mailbox A
(Angela) and group mailbox B (Bank Department),

When I open a mail from Mailbox A, and run macro ReplyAll() below, the
FROM field of the email will be changed from Angela to Bank Department
correctly, and displaying the following results:
(e-mail address removed) - Angela
Angela - Bank Department
(e-mail address removed) - Bank Department

However, when I open a mail from group Mailbox B, and run macro
ReplyAll() below, the FROM field will remain unchanged as Bank
Department, even though the following results are displayed correctly:
(e-mail address removed) - Bank Department
Bank Department - Angela
(e-mail address removed) - Angela

Is it because of the group mailbox settings? Or is there a bug? I have
tried many different methods but still, the FROM field is not changed
on the second case. I have even tried to programmatically copy the
email from B to A and ReplyAll() from A, it still remain unchanged as
Bank Department. Please advise.

Public Sub ReplyAll()

Dim oAccount As Outlook.Account
Dim oMail As Outlook.MailItem
Dim oNewMail As Outlook.MailItem
Dim oReplyMail As Outlook.MailItem

Set oMail = Application.ActiveExplorer.Selection(1)
Set oReplyMail = oMail.ReplyAll
oReplyMail.Display

MsgBox oReplyMail.SendUsingAccount.SmtpAddress & " - " &
oReplyMail.SendUsingAccount.DisplayName

For Each oAccount In Application.Session.Accounts
If oAccount <> oReplyMail.SendUsingAccount Then
MsgBox oReplyMail.SendUsingAccount & " - " & oAccount
oReplyMail.SendUsingAccount = oAccount
Exit For
End If
Next

MsgBox oReplyMail.SendUsingAccount.SmtpAddress & " - " &
oReplyMail.SendUsingAccount.DisplayName

End Sub

Thanks,
Vic
 
Back
Top