Copy and Pasting Grouped Image(s) into email using vba

Lostchrono

New Member
Joined
Jun 30, 2014
Messages
3
Hello,

I have the code to auto generate an email using vba. I need to be able to auto generate this email and paste a copy of an image from one of my sheets into the body. Basically it is a Certificate of recognition. I need it to be able to print out, which I have the code for, and email the person the certificate as well.

I have been googling this answer, as well as testing my own thougts, for over a day now and have found several macros for copy and pasting charts and cells but not one for a picture within a sheet. I have tried a Copy and Paste fuction and CopyPicture function and still can't figure it out. Any help would be beneficial. Below you will find the code that I have thus far as well as the CopyPicture variable that I tried to set up but failed. Thank you!


Code:
Sub MailOutlook()

    Call InsertTextName
    
    Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String


    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    
    strbody = "Congratulations " & Worksheets("Kudos").AgentNameType.Text & "!" & vbNewLine _
                & "You have been awarded a Certificate of Recognition.  Keep up the great work!" _
                & Worksheets("Certificate").Shapes("CertAll").CopyPicture
                
    On Error Resume Next
    With OutMail
        .To = "MegaManX@AbelCity.org"
        .CC = ""
        .BCC = ""
        .Subject = "Congratulations to " & Worksheets("Kudos").AgentNameType.Text
               
        .Body = strbody
        .Send
    End With


    Set OutMail = Nothing
    Set OutApp = Nothing
    
'    Sheets("Certificate").PrintOut
End Sub
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,214,923
Messages
6,122,286
Members
449,076
Latest member
kenyanscott

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top