title: Outlook VBA change Send using account when item load
body: <p>I'm trying to change the From account when an item loads in Outlook 2010 using VBA. I have two accounts, a gmail account and a POP3. </p>
  
  <p>When replying, replying all, and forwarding Outlook defaults to the account that the email was received through. If I receive an email through Gmail, I want to reply with a POP3 account. Even though my default account is the POP3 account, Outlook changes it to Gmail. </p>
  
  <p>This is what I have so far. Unfortunately I get the error: Run-time error '-6936698555 (d6a70005)': You don't have appropriate permission to perform this operation.</p>
  
  <pre><code>Private Sub Application_ItemLoad(ByVal Item As Object)
      Set myObj = GetCurrentItem()
      If TypeName(myObj) = "MailItem" Then
          Set OutApp = CreateObject("Outlook.Application")
          Set oMail = OutApp.CreateItem(olMailItem)
          Dim oAccount As Outlook.Account
  
          Set oMail = myObj
  
          oMail.SendUsingAccount = oMail.SendUsingAccount.Session.Accounts.Item(1)
      End If
  End Sub
  
  
  Function GetCurrentItem() As Object
      Dim objApp As Outlook.Application
  
      Set objApp = Application
      On Error Resume Next
      Select Case TypeName(objApp.ActiveWindow)
          Case "Explorer"
              Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
          Case "Inspector"
              Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
      End Select
  
      Set objApp = Nothing
  End Function
  </code></pre>
  
  <p>Am I going about this the right way by doing it on Item load? Why don't I have permission to change the sender? Is it because VB didn't create the email?</p>