Outlook macro - SendUsingAccount - settings error or bug?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top