• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
You are here: Home
Lost password?
sp_Search
Advanced Search|Last Search Results
Advanced Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search

Please confirm you want to mark all posts read

Mark all topics read

sp_MobileMenu Actions
Actions
sp_LogInOut
Log In
sp_Search

Search Forums

sp_RankInfo
Ranks Information
Avatar

New/Updated Topics

General Excel Questions & Answers

  Data Validation with unique values

  Quartile reporting

  Create calendar with slicers or vba ?

  Sick leave periods in one cell

  removing pesky hidden xml sheets in a workbook

  Excel Is Running Slow

VBA & Macros

  VBA Update the body from a template email

Power Query

  Running total in power query

  Removing columns in Power BI source file

  Opening several PDFs from a Sharepoint site, and validating …

  Using Table.ReplaceValue with Text.Combine to do an in place…

  Converting Values from positive to Negative in Power Query

Power Pivot

   Problem in Runing Total using Pivot Table

Xtreme Pivot Tables

  Structuring data to drive pivot tables.

Select Forum

  Rules and Guides

Forum Rules and Guides

  Public Forums - For Registered Users

General Excel Questions & Answers

Dashboards & Charts

VBA & Macros

Power Query

Power Pivot

  Course Members Only

Excel Dashboards

Power Query

Power Pivot

Xtreme Pivot Tables

Excel for Decision Making

Excel for Finance

Power BI

Excel

Word

Outlook

Excel Expert

Excel for Customer Service Professionals

Excel Analysis Toolpak

Excel Tables

Excel for Operations Management

Financial Modelling

Advanced Excel Formulas

Pivot Tables Quick Start

ForumsVBA & Macros
sp_TopicIcon
Choose which Outlook account to send email
Avatar
Marsil Sarvis
Posts: 73
Level 0
October 19, 2020 - 12:51 am

1

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

sp_AnswersTopicSeeAnswer
Avatar
Philip Treacy
Posts: 1517
Level 10
October 19, 2020 - 12:21 pm

2

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

sp_AnswersTopicAnswer
Avatar
Marsil Sarvis
Posts: 73
Level 0
October 20, 2020 - 6:35 am

3

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

Avatar
Marsil Sarvis
Posts: 73
Level 0
October 22, 2020 - 8:50 am

4

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

Avatar
Philip Treacy
Posts: 1517
Level 10
October 29, 2020 - 3:14 pm

5

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

Forum Timezone:
Australia/Brisbane
Most Users Ever Online: 245
Currently Online: RAQUEL ACION, Dana Friedt, Nada Perovic
Guest(s) 10

Devices in use: Desktop (8), Phone (5)

Forum Stats:
Groups: 3
Forums: 24
Topics: 6218
Posts: 27266
Member Stats:
Guest Posters: 49
Members: 31901
Moderators: 3
Admins: 4
© Simple:Press

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.