Results 1 to 4 of 4

Copy/Paste into Outlook

Threaded View

  1. #1
    Registered User
    Join Date
    08-18-2011
    Location
    NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Angry Copy/Paste into Outlook

    I'm new to coding in excel although I find it very interesting and fun!

    What I am attempting to accomplish is copying a select amount of cells in a worksheet and paste into an email with a button click. As of now, with help from here and online browsing, I'm able to get the code to copy the cells and open an email session (outlook) with fields filled out. My problem now is that I can't get the image to paste into the email unless I press CTRL + V.

    What am I missing? This is what I have:

    
    Sub Mail_Sheet_Outlook_Body()
    ' Don't forget to copy the function RangetoHTML in the module.
    ' Working in Office 2000-2010
    
    Worksheets("Sheet1").Range("A1:N49").CopyPicture _
        Appearance:=xlScreen, Format:=xlPicture
    
        Dim rng As Range
        Dim OutApp As Object
        Dim OutMail As Object
        With Application
            .EnableEvents = False
            .ScreenUpdating = False
        End With
     
        Set rng = Nothing
        Set rng = ActiveSheet.UsedRange
        'You can also use a sheet name
        'Set rng = Sheets("YourSheet").UsedRange
    
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
     
        On Error Resume Next
        With OutMail
            .To = ""
            .CC = ""
            .BCC = ""
            .Subject = "Closing Report - 12th Floor - " & Sheets("Sheet1").Range("C4").Value
            .HTMLBody = Outlook.Paste.Select
            .Display   'or use .Display
        End With
        On Error GoTo 0
     
        With Application
            .EnableEvents = True
            .ScreenUpdating = True
        End With
     
        Set OutMail = Nothing
        Set OutApp = Nothing
    End Sub
    Last edited by rivera82falcon; 02-07-2012 at 03:53 PM. Reason: Title error

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