My first post in this forum.

I have been trying to establish exactly how to send an email from an excel application and all seems to work except how to specify the account to use.

I have used the following code (I have changed the references to the true account names in the comments).
If mail_account_nos =1 then .body line generates an item with email account 1 (say
If mail_account_nos =2 then .body line generates an item with email account 2 (say
BUT the email is always sent from the same OUTLOOK account - in this case the default is anne - i.e. the sendusingaccount statement appears to make no difference.

Any ideas please ?
Sub Send_Email_Using_VBA(mailaddress As String, mailcontent As String, mailsubject As String)
Dim mail_account_nos As Integer
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(olMailItem)
    On Error GoTo debugs
    mail_account_nos = 2
    With OutMail
        .Subject = mailsubject
        '.From = ""     '<<<<<<<<<<<<<<<<this fails - "Object doesn't support this object or method"
        .To = mailaddress
        .Recipients.Add (mailaddress)   '   same as .To (I think)
        .CC = mailaddress
        .BCC = mailaddress
        .Body = "===1===" + vbCrLf + mailcontent + vbCrLf + OutApp.Session.Accounts.Item(mail_account_nos) + vbCrLf + "===1==="
        .Display                       '<<<<<<<<<<<<<<<<OutApp.Session.Accounts.Item(mail_account_nos) change 2 to 1 and it changes this output but not the account sent from
        '.HTMLBody = strbody & "<br><br>" & Signature
        'You can add files also like this
        '.Attachments.Add ("C:\test.txt")
        .SendUsingAccount = OutApp.Session.Accounts.Item(mail_account_nos)  '  have 2 accounts "" and "" always send from anne - the default

    End With
    If Err.Description <> "" Then MsgBox Err.Description
    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub