0
votes

When I reply to an email in my group inbox, Outlook defaults to the group's account to send the message from. So what I normally do is click on the drop down menu under "From" and choose "other email address".

I have written a little VBA macro to have Outlook 2010 reply to emails in my group's inbox using my account instead of the group's account, however for some reason it is still replying from my group's account when I execute the macro shown below. Any ideas what is wrong with my VBA macro ? Thanks

Sub ReplyFromMyAccount()
  Dim rpl As Outlook.MailItem
  Dim itm As Object
  itm = GetCurrentItem()
  If Not itm Is Nothing Then
    rpl = itm.ReplyAll
    rpl.SendUsingAccount = Session.Accounts.Item(1)
    rpl.Display()
  End If
  rpl = Nothing
  itm = Nothing
End Sub

Function GetCurrentItem() As Object
  Dim objApp As Outlook.Application
  objApp = Application
  On Error Resume Next
  Select Case TypeName(objApp.ActiveWindow)
      Case "Explorer"
          GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
      Case "Inspector"
          GetCurrentItem = objApp.ActiveInspector.CurrentItem
  End Select
  objApp = Nothing
End Function
1

1 Answers

0
votes

Try .SentOnBehalfOfName

There may be anomolies with this as described here. Outlook code is working when manually called but giving trouble from Application_ItemSend