+ Reply to Thread
Results 1 to 10 of 10

Email .pdf attachment using Outlook and send formatted message.

  1. #1
    Registered User
    Join Date
    02-08-2014
    Location
    United States
    MS-Off Ver
    Excel 2011
    Posts
    60

    Email .pdf attachment using Outlook and send formatted message.

    Hello,
    I know there are posts on here about how to create and send .pdfs using outlook but I have yet to find a post that allows you to also send a customized, formatted message along with the email.

    Basically, on the attached, I have dates in cells C2, C3 and E3 that I need to reference in the vba code. I am trying to send the message in cell A10 to the email in C7 using outlook and sending the spreadsheet as the attachment in a .pdf file.

    Is there any way to do this?
    Attached Files Attached Files

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Email .pdf attachment using Outlook and send formatted message.

    You've posted a xlsx file, that doesn't have any code. Do you have a file WITH the code?

    If not, then read this article about how to accomplish that. If you need further help, then post back.
    David
    (*) Reputation points appreciated.

  3. #3
    Registered User
    Join Date
    02-08-2014
    Location
    United States
    MS-Off Ver
    Excel 2011
    Posts
    60

    Re: Email .pdf attachment using Outlook and send formatted message.

    Thank you.

    I tried that link but it was overly complicated.

    The attached contains code and sends the email exactly the way I want except for two things: 1)it doesn't send it to the email address in C11 on each (and future) tabs, only to the active worksheet. I need it to automatically send to the email addresses on all (and future) worksheets 2)It doesn't contain the formatting found in A16 of the Total tab and the automatically updating dates for each pay period on the Total tab cells C3, C4 and E4.

    I really appreciate your help.
    Attached Files Attached Files

  4. #4
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Email .pdf attachment using Outlook and send formatted message.

    Ok, so the problem isn't with the code, but with the text in the cell.

    Even though it's text, you still have to treat it like a formula and the formula is limited to 255 characters.

    Break it up into sentence size cells. Then you can concatenate the cells together in the code.

    The first one could be
    A16="Please find the attached Bonus/Commission breakdown for the pay period of*" &TEXT(C4, "mm/dd/yyyy") &" to "&TEXT(E4, "mm/dd/yyyy")&" paid on "&TEXT(C3, "mm/dd/yyyy")&"."

    The second
    A17="This breakdown includes*ALL*commissions/bonuses accrued and paid for the month to date. Please note I will be processing payroll*MONDAY AT NOON! "

    Etc...

    Then, in your email code...

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-08-2014
    Location
    United States
    MS-Off Ver
    Excel 2011
    Posts
    60

    Re: Email .pdf attachment using Outlook and send formatted message.

    Thanks Tinbendr. The code is giving me a runtime error 424 when I change

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-08-2014
    Location
    United States
    MS-Off Ver
    Excel 2011
    Posts
    60

    Re: Email .pdf attachment using Outlook and send formatted message.

    "Total" is the name of the worksheet I need to reference the email body.

  7. #7
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Email .pdf attachment using Outlook and send formatted message.

    May have to change that to:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-08-2014
    Location
    United States
    MS-Off Ver
    Excel 2011
    Posts
    60

    Re: Email .pdf attachment using Outlook and send formatted message.

    Thank you. Worked like a charm.

  9. #9
    Registered User
    Join Date
    02-08-2014
    Location
    United States
    MS-Off Ver
    Excel 2011
    Posts
    60

    Re: Email .pdf attachment using Outlook and send formatted message.

    Okay, so the email gets created and sent. Does anyone know how to incorporate formatting to make the dates bold in the body of the email? Also, how do I send to multiple worksheets at once? For instance, all worksheets that contain "ILA" in the tab name.

  10. #10
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Email .pdf attachment using Outlook and send formatted message.

    For the formatting, you'll have to use HTML.

    You'll have to split the paragraph up a little more.

    A16="Please note you will see your Gross Pay total located at the bottom of your breakdown in the bottom right hand corner which also includes your salary/hourly pay if applicable. "

    Let's setup the Worksheet name so we can work with a shorter reference.

    Please Login or Register  to view this content.
    It's kind of a pain to setup but usually worth it in the end.

    Then sheets is a For Next

    Please Login or Register  to view this content.
    Post back if you have any more problems.

+ 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. [SOLVED] formatted sheets get unformatted when send via email attachment?
    By TJ in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 PM
  2. [SOLVED] formatted sheets get unformatted when send via email attachment?
    By TJ in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  3. formatted sheets get unformatted when send via email attachment?
    By TJ in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  4. [SOLVED] formatted sheets get unformatted when send via email attachment?
    By TJ in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  5. formatted sheets get unformatted when send via email attachment?
    By TJ in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM

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