Forum

Choose which Outloo...
 
Notifications
Clear all

Choose which Outlook account to send email

5 Posts
2 Users
0 Reactions
323 Views
(@marsil)
Posts: 72
Estimable Member
Topic starter
 

Hi,

 

Please can you help to handle attach macro to let me choose which account will be used to send email as I have two in my PC.

 

Thanks,

Marsil

 
Posted : 19/10/2020 10:51 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Marsil,

Insert this snippet into your code after you've created objOutlookMsg

Dim Account As Outlook.Account

For Each Account In objOutlook.Session.Accounts

    'Debug.Print Account.DisplayName
    If Account.DisplayName = "Insert account name" Then
    
        objOutlookMsg.SendUsingAccount = Account
    
    End If
Next

 

Insert the account name you want to use in place of the red text.  If your not sure of the account name, uncomment the green line and all account names will be printed to the Immediate Window.

Regards

Phil

 
Posted : 19/10/2020 10:21 pm
(@marsil)
Posts: 72
Estimable Member
Topic starter
 

Hi Phil,

I really appreciate your help and time

It works perfectly. You are amazing! Thank you so much!

Just need help please, can you help to add other column to write another Path for another file.

Please check attached macro.  "Red column"

Thanks;

Marsil

 
Posted : 20/10/2020 4:35 pm
(@marsil)
Posts: 72
Estimable Member
Topic starter
 

Hi Phil,

It is ok now as I changed the macro to add many attached files, but I face an issue  to add below to select which Outlook account to send email.

please check attached file and I really appreciate your help and time to update the macro.

Dim Account As Outlook.Account

For Each Account In objOutlook.Session.Accounts

    'Debug.Print Account.DisplayName
    If Account.DisplayName = "Insert account name" Then
    
        objOutlookMsg.SendUsingAccount = Account
    
    End If
Next

 

Thanks;

Marsil

 
Posted : 22/10/2020 6:50 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Marsil,

You insert in where I said to insert it in Reply #2 above.

Insert it after Set objOutlookMsg = objOutlook.CreateItem(0)

See attached.

Regards

Phil

 
Posted : 30/10/2020 1:14 am
Share: