0

I am trying to set up a macro to give me a pop up box to choose which email account I send an email from. I have actually found macros on here which do this but after several attempts during work time all I get is a button on my toolbar which does nothing!

Could anyone give me a detailed description on what to do?

Here is the macro I attempted -

Sub SendfromLE()
Dim oAccount As Outlook.Account
Dim oMail As Outlook.MailItem

For Each oAccount In Application.Session.Accounts
   If oAccount = "LeadEmployerRecruitment" Then
      Set oMail = Application.CreateItem(olMailItem)
      oMail.SendUsingAccount = oAccount
      oMail.Display
   End If
Next
End Sub

I'm not sure if I have named the account properly? Does it need to be the full email address or just the name?

1

1 Answer 1

0

Try this

For Each oAccount In Application.Session.Accounts

Debug.Print oAccount
If oAccount = "Whatever you see in the immediate pane" Then
    Set oMail = Application.CreateItem(olMailItem)
    oMail.SendUsingAccount = oAccount
    oMail.Display
End If
Next

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .