+ Reply to Thread
Results 1 to 3 of 3

Pasting Range of Cells into Outlook with Other Text in Body?

  1. #1
    Registered User
    Join Date
    04-14-2014
    Location
    Atlanta, GA, USA
    MS-Off Ver
    Excel 2016
    Posts
    46

    Pasting Range of Cells into Outlook with Other Text in Body?

    Hello! I am still looking for help with this code!

    I've searched for how to do this, including on Ron De Bruin's website, and have yet to see how you can copy a range of cells in Excel from a file into the body of an email that already has text plus attach a separate file to the email. I'm sure it's doable, but I'm way too new at all of this to figure out the correct code to use.

    The cells that need to be copied will always be in a file named SPSS CHECK--Daily ER Production Aggr by Region Type & ER.xlsx in columns A-K, but the number of rows in that range will vary by day. I've identified where I'd want these cells to be pasted in the code below, but with no attempt at coming up with the code for that.

    BTW, is there a way to add a hard space at the end of sentences so that two spaces always appear between the end of one sentence and the beginning of another, or is that an Outlook quirk that strips out extra spaces and reformats the text?

    Here is my code so far:
    Please Login or Register  to view this content.
    Last edited by bryanmarks; 06-05-2014 at 10:08 AM.

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

    Re: Pasting Range of Cells into Outlook with Other Text in Body?

    You have to generate a HTML string using Ron's function and 'build' a final string to assign to .HTMLBody.
    Please Login or Register  to view this content.
    Last edited by Tinbendr; 06-05-2014 at 01:55 PM.
    David
    (*) Reputation points appreciated.

  3. #3
    Registered User
    Join Date
    04-14-2014
    Location
    Atlanta, GA, USA
    MS-Off Ver
    Excel 2016
    Posts
    46

    Re: Pasting Range of Cells into Outlook with Other Text in Body?

    Hi, David,

    Thanks for the suggestion! It got me much closer to where I wanted to be, but still needed a lot of additional code to do what I wanted. This included adding the Function RangetoHTML(rng As Range) code from Ron de Bruin's page, without which the code will never run. At first, I thought I wanted a block of cells that would be in another file to be copied and pasted into the email, then realized that could make a very long email, so I created a macro ("FindGrandTotal") to only pull the information on the Grand Total line plus the approprite column headers.

    Here is what I ended up using. I'm hoping someone else out there will find it of some use. I'm picking it up where the
    Please Login or Register  to view this content.
    is created. The Function RangetoHTML(rng As Range) code is shown below that.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

+ 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. Pasting Table Autoformat into Outlook Email Body
    By frolicols in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2014, 11:30 AM
  2. VBA to select a Range of cells as Email Body In Outlook
    By TC922 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-16-2013, 11:06 AM
  3. [SOLVED] VBA Code to select Range of cells as Email Body In Outlook
    By naveenmarapaka in forum Outlook Programming / VBA / Macros
    Replies: 5
    Last Post: 09-16-2013, 06:43 AM
  4. Not sure how to split Outlook Body Text to Single Cells
    By aftabn10 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-17-2012, 08:13 AM
  5. Replies: 7
    Last Post: 08-11-2012, 02:39 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