+ Reply to Thread
Results 1 to 9 of 9

Macro to Draft Outlook Emails and Attach files in Emails

  1. #1
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Macro to Draft Outlook Emails and Attach files in Emails

    Hi, Requesting for help.

    I am using the below code to draft several emails. I need help in attaching excel files in these mails which i am doing manually now.

    The subject of the mail has values from column E. Example - Column E has a value "AAA", the subject of the mail also has "AAA". Now, Out of several files, there is an excel file with same name "AAA" in the desktop folder which has to be attached in the same email which has subject with "AAA"

    Can you please help. The files are available in this folder and path is C:\Users\203045\Desktop\Mand Course.

    The codes that i use is attached.
    Attached Files Attached Files
    Last edited by arun.sj; 08-14-2020 at 02:15 AM.

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Macro to Draft Outlook Emails and Attach files in Emails

    Untested but I think you should get away with doing this and building the path name with your AAA file name and extension

    Please Login or Register  to view this content.
    Happy with my advice? Click on the * reputation button below

  3. #3
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Macro to Draft Outlook Emails and Attach files in Emails

    Quote Originally Posted by Crooza View Post
    Untested but I think you should get away with doing this and building the path name with your AAA file name and extension

    Please Login or Register  to view this content.
    Thank you so much..

    however we cannot mention the file name in the code because it has to pick and attach the right file from the folder. Example - column E2 in the excel file has value "AAA", E3 has "BBB" and E4 has "CCC".. In this case 3 mails are drafted here with Subject mentioning "AAA" for 1st mail, "BBB" for 2nd mail and "CCC" for 3rd Mail. The 1st mail need to attach the file "AAA" from the folder, similarly the 2nd mail need to attach file "BBB" and 3rd mail has to attach file named "CCC"

  4. #4
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Macro to Draft Outlook Emails and Attach files in Emails

    That's why I said you'll need to build the path name. it looks like your code is getting it from this piece here already

    Please Login or Register  to view this content.
    so i'd use that to build your path from my post above

  5. #5
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Macro to Draft Outlook Emails and Attach files in Emails

    Quote Originally Posted by Crooza View Post
    That's why I said you'll need to build the path name. it looks like your code is getting it from this piece here already

    Please Login or Register  to view this content.
    so i'd use that to build your path from my post above
    I tried using the below code but getting the error - "Automation error.. The system cannot find the path specified.

    Please Login or Register  to view this content.
    Attachment 690960

  6. #6
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Macro to Draft Outlook Emails and Attach files in Emails

    Requesting for Help and support

  7. #7
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Macro to Draft Outlook Emails and Attach files in Emails

    I suggest you attach your workbook. Likely that the file name in columnE isn’t being added to the oath name string correctly

  8. #8
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Macro to Draft Outlook Emails and Attach files in Emails

    OK. I just played around with your code and created a worksheet based on what I could see in your data.



    Make sure in column E you have the proper file name and extension ie test.docx

    then in this line make sure you have the full and proper path

    .Attachments.Add "C:\put the full path in here from your first post\" & Cells(i, 5).Value
    Last edited by Crooza; 08-14-2020 at 11:10 PM.

  9. #9
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Macro to Draft Outlook Emails and Attach files in Emails

    Quote Originally Posted by Crooza View Post
    That's why I said you'll need to build the path name. it looks like your code is getting it from this piece here already

    Please Login or Register  to view this content.
    so i'd use that to build your path from my post above
    Thank you so much

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Extract PDF Files from outlook emails
    By tejboyd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2019, 02:20 AM
  2. Macro to create emails, attach files, add recipient and add subject line
    By dw_22801 in forum Outlook Programming / VBA / Macros
    Replies: 8
    Last Post: 05-08-2017, 05:11 PM
  3. [SOLVED] Macro to attach a file to out going emails?
    By THTABE in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-21-2016, 09:48 AM
  4. Track Outlook Emails - sent emails in Excel
    By baluraipur in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2015, 09:18 AM
  5. [SOLVED] VBA code required to draft emails in outlook taking excel inputs.
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2015, 03:56 PM
  6. [SOLVED] Sending Outlook emails from Excel; Limits to three emails only?
    By BPSJACK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2013, 06:53 AM
  7. Send outlook emails with message in cells to individual emails associated with them
    By abinayan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-21-2011, 06:11 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1