2013-07-19 21 views
0

當我回復我的組收件箱中的電子郵件時,Outlook將默認使用該組的帳戶發送郵件。所以我通常會點擊「From」下的下拉菜單並選擇「其他電子郵件地址」。在Outlook中設置SendUsingAccount回覆的VBA代碼

我寫了一個VBA宏,使Outlook 2010能夠使用我的帳戶而不是羣組帳戶回覆我的羣組收件箱中的電子郵件,但由於某些原因,當我執行下面顯示的宏時,仍然從我的羣組帳戶回覆。任何想法我的VBA宏有什麼問題?由於

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 

回答