+ Reply to Thread
Results 1 to 2 of 2

VBA to Paste Table from Excel into Outlook Message and Create Subject.

Hybrid View

  1. #1
    Registered User
    Join Date
    12-09-2014
    Location
    England
    MS-Off Ver
    365
    Posts
    9

    VBA to Paste Table from Excel into Outlook Message and Create Subject.

    Hello,

    Torachan has very kindly helped me with a VBA to save as a PDF with a file name but I'd also like to copy the contents of a excel worksheet and paste into the body of an outlook message with a subject. I'm not to concerned whether it is a jpeg or not but at the very least I would like to maintain the formatting.

    I've created a control button (Send to Email) and the Subject is within W5 on 001.

    Can anyone kindly help?
    Attached Files Attached Files
    Last edited by thbutterflycollector; 09-28-2021 at 02:35 PM.

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,765

    Re: VBA to Paste Table from Excel into Outlook Message and Create Subject.

    Very simple:

    Private Sub CommandButton2_Click()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim wordEditor As Object
    
        ActiveSheet.Range("A1:M49").CopyPicture     ' reference into range of cell to paste into email as picture
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
        With OutMail
            .To = "address1@somewhere.com"      ' or reference into cell
            .CC = "address2@somewhere.com"      ' or reference into cell
            .BCC = "address3@somewhere.com"     ' or reference into cell
            .Subject = ActiveSheet.[W5].Value
            .HTMLBody = "<br><br>There is Early notice about something<br>regards<br>Sender"
            .Display   '  or 'Send - then send without new message window in outlook
        End With
        Set wordEditor = OutApp.ActiveInspector.wordEditor
        wordEditor.Application.Selection.Paste
    End Sub
    Last edited by KOKOSEK; 09-29-2021 at 03:13 AM.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

+ 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. VBA: Post Excel Table Contents into MS Office Outlook 2010 Message
    By josephyschen89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2018, 12:04 PM
  2. excel macro to create outlook message - with Private sensitivity
    By aarona in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2017, 02:22 AM
  3. [SOLVED] Paste Excel range into Outlook message body as picture
    By Andrew Entee in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-12-2016, 05:49 PM
  4. Extract Subject and Body of an Outlook Message into Excel
    By Saarang84 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-25-2016, 12:31 AM
  5. Cross reference Outlook message subject with Excel list.
    By Karl Kennedy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2014, 10:12 AM
  6. Automatically Create Outlook Task When Value <50 using adjacent cell as subject/title
    By indiegoober in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2013, 10:17 AM
  7. Substitute bookmarks/subject from Outlook message from Excel rows/cells then loop
    By nylevolm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-23-2013, 11:02 AM

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