+ Reply to Thread
Results 1 to 5 of 5

Sending an email with attachment using VBA

  1. #1
    Registered User
    Join Date
    02-26-2015
    Location
    Weymouth, Dorset
    MS-Off Ver
    2007
    Posts
    14

    Sending an email with attachment using VBA

    Hi

    I'm not sure whether what I am trying to do is possible, but I'd be grateful for any replies, even if just "you can't do that"! Every month, I need to send out reports to all my heads, which involves exporting some data from Oracle Discoverer to a main document, then using VBA to create a number of separate workbooks, all of which is working fine. However, I then need to email each of the workbooks I've just created to a different person. There are well over 200 of them, so automation is definitely the way to go. My goal is to open each workbook separately from within the main document, add the opened workbook as an attachment to an email and then send that email to the correct recipient. I have got as far as creating the email and adding the attachment just by using the following...

    Workbooks.Open Filename:= _
    "[full file path and name] School Health.xlsx"
    Application.Dialogs(xlDialogSendMail).Show

    ...but I can't work out how to use VBA to add the details of the recipient (there will be at least one person in the "To" box and one "CC" and then to automatically send the email. Is this even possible? Many thanks for any help anyone can provide.

    Apologies if this has been asked before - I did a quick search but couldn't see anything that exactly matches what I am looking for.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Sending an email with attachment using VBA

    What email client are you using?
    If posting code please use code tags, see here.

  3. #3
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,198

    Re: Sending an email with attachment using VBA

    Without seeing your sheets and stuff, I always find the below link useful to getting where I want to go

    I would personally email the spreadsheets as they are created, it seems an extra step to reopen them

    https://www.rondebruin.nl/win/s1/outlook/mail.htm

    I also assume you are using outlook as the email client

  4. #4
    Registered User
    Join Date
    02-26-2015
    Location
    Weymouth, Dorset
    MS-Off Ver
    2007
    Posts
    14

    Re: Sending an email with attachment using VBA

    Sorry, Outlook.

  5. #5
    Registered User
    Join Date
    02-26-2015
    Location
    Weymouth, Dorset
    MS-Off Ver
    2007
    Posts
    14

    Re: Sending an email with attachment using VBA

    Thanks Davsth - that works perfectly. I have bookmarked that page now and added reputation for you.

+ 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. Sending form from excel thru email as an attachment
    By Aplcinnamon in forum Excel General
    Replies: 1
    Last Post: 02-06-2015, 04:40 AM
  2. olMail - Email Attachment Variable. Sending Email through Excel
    By ShakJames in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2014, 07:55 AM
  3. olMail - Email Attachment Variable. Sending Email through Excel
    By ShakJames in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-23-2014, 07:41 AM
  4. [SOLVED] Sending attachment in email using vba
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-18-2014, 10:02 AM
  5. sending an Excel worksheet as an xls attachment through email
    By grammadolly9 in forum Excel General
    Replies: 2
    Last Post: 02-15-2013, 03:51 AM
  6. [SOLVED] Sending email with attachment
    By Nu2Java in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-28-2012, 04:15 PM
  7. Sending email attachment(s) from Excel 2007
    By nobleprince in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-28-2010, 12:33 PM

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