Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
It's been years since I did this stuff, but you can also ask on slipstick - Diane Poremsky, Sue Mosher, and those Outlook/Exchange gurus. slipstick.com/discuss.htm#.T99kzbVYs8o –  gibberish Jun 18 '12 at 17:28

1 Answer 1

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.