VBA- Copy & Paste Range into Outlook as a Picture

Trae1170

New Member
Joined
Apr 11, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello everyone, I have very, very limited knowledge of VBA and I generally just find code does something similar to what I need and try to modify it it to work for me. Not for this one though lol .
In this instance I have a button in a report summary, I would like to click the button "Send Email to Team" and have it highlight and copy a range from the report, open a new Outlook email, enter the "To", "subject" and Text in body and then paste the selection as a picture.

I have the code that copies the range, automatically opens a new Outlook email for me and enters the "To" address, Subject and some text into the email body based on text coming from specific cells in a report.

What I still need is how to Paste the range from the report into the email just after the text in the Body. I would like it to take the range and convert it to a picture if possible just so it keeps it formatting and can be easily resized if needed.
I do not want it to send the email, just generate it with the picture so additional info can be added if need prior to Sending the email.

I am using Office 360 Enterprise - Excel version 2308
Here is my current code and a snapshot of my spreadsheet.

Sub Sendemail()

Range("A10:L60").Select
Selection.Copy

Dim OutApp As Object, OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

With OutMail
.To = Range("B1").Value
.Subject = Range("B2").Value
.Body = Range("B3").Value

.Display
' .Body = Selection.Paste
' Selection.Paste

End With

End Sub

' Set OutMail = Nothing



Thank you in Advance,
 

Attachments

  • 2024-04-11_14-08-48.jpg
    2024-04-11_14-08-48.jpg
    177.8 KB · Views: 7
  • 2024-04-11_14-08-48.jpg
    2024-04-11_14-08-48.jpg
    177.8 KB · Views: 7

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try the following...

VBA Code:
With OutMail
    .Display
    .To = Range("B1").Value
    .Subject = Range("B2").Value
    With .GetInspector.WordEditor
        '.Application.Selection.EndKey Unit:=6 'wdStory (optional)
        '.Application.Selection.typeparagraph 'new line/carriage return (optional)
        '.Application.Selection.typeparagraph 'new line/carriage return (optional)
        .Application.Selection.Paste
    End With
End With

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,215,201
Messages
6,123,621
Members
449,109
Latest member
Sebas8956

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