+ Reply to Thread
Results 1 to 13 of 13

Macro to Mail out my Reports

  1. #1
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    Macro to Mail out my Reports

    Hello again, I am looking to make my job a bit more simple and help some co-workers at the same time. I run these Excel reports off a data webpage everyday and sent bits of data from them to several locations all around the US. I have already created a Macro to make these reports pretty and have found out that you can use Outlook with Excel to send data.
    I have an outlook template made and all I need to do it place data off my report into the body of this template and insert the correct adress and CC to these locations.

    My e-mail template already has a subject line and most of the body complete.

    What I need:
    1. Copy data from Excel to Outlook Template into a certian section of the body.
    2. Add the correct e-mail adress/CC based on a value in the data copied.
    3. Send the e-mail
    Right now I must manually copy and paste data out of my excel and place it into the body of my outlook template. Then lookup the location managers e-mail of the location I am
    sending this data too. A macro to do this would be much more efficent.

    I will add an example of the report in the exact format needed. All data in this report is false and only for the use of this example.

    Thanks in advance.
    Attached Files Attached Files
    Last edited by Mordred; 08-31-2011 at 02:39 PM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Macro to Mail out my Reports

    See this page: Example Code for sending mail from Excel
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Mail out my Reports

    Hi TWent

    Can you show us the code you have? Is your code running from Outlook or Excel? Attach the workbook you have (including code).

    Reinventing/Guessing only makes possible solutions more difficult.

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Macro to Mail out my Reports

    Here is an example of what I need. I can get this far on my own but its doesn't make things much faster unless I make a macro for each of my 80 somthing locations. I need this macro to select rows based on a value in column F. Then snap that information to a grid in an outlook template and send it to that approite mail adresses. All this based on the value in Column F. The reason for this is that Column F is a city and state and each has its own manager that receives reports form me daily. So I only want to send them their locations information.

    If this can't be done then maybe there is another way to still save me some time.


    Please Login or Register  to view this content.
    As always thanks in advance.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Mail out my Reports

    Hi TWent

    Try the code in the attached. It should get you started. If I can help, feel free to ask.

    I'd recommend you put a break point in the procedure before you run or you'll get over 30 emails displayed.

    Let me know of issues.

    John
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Macro to Mail out my Reports

    This seems to be exactly what I need. I just need to modify a few things. Maybe you can help me. I have a very basic understanding of VBA. Like how can I make is so the e-mail will open with my template and the boday will snap to a grid I have made.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Mail out my Reports

    Hi TWent

    Sorry, I attached the wrong workbook. The attached does this
    how can I make is so the e-mail will open with my template
    In the Procedure "Mail_Reports()" you'll need to change this line of code
    Please Login or Register  to view this content.
    Regarding this
    the body will snap to a grid I have made
    I'm not familiar with this process. If you will attach a copy of your template, perhaps I can figure something out. You'll probably need to zip the file as .oft is not a valid file name for attaching.

    John
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Macro to Mail out my Reports

    Thank You so much for your help thus far. It seems we are close to exactly what I need. I have attached an example of my template and have indicated where exactly I need the Data pasted into. Thanks again for all you have shown me.
    Attached Files Attached Files

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Mail out my Reports

    Hi TWent

    I've some ideas...it may take a little while.

    John

  10. #10
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Macro to Mail out my Reports

    Not a problem, unfortunalty I do not have the kind of time I would like to work on building Macros.

    Thanks for all your help.

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Mail out my Reports

    Hi TWent

    The attached should be getting close. This has been tested with Excel 2007 and Outlook 2007. Don't know what happens with earlier (or later) versions.

    Again, you'll need to change this code
    Please Login or Register  to view this content.
    If you wish the procedure to send the Emails, change this code
    Please Login or Register  to view this content.
    (uncomment ".Send")

    Let me know of issues.

    John

    PS: I noticed I wasn't picking up all the headings in the email. Change this line of code
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jaslake; 10-19-2010 at 03:51 PM.

  12. #12
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Macro to Mail out my Reports

    Thank you!

  13. #13
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Macro to Mail out my Reports

    Can an admin please mark this to solved. I am unable to edit my first post to reflect this thread as solved. Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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