Pasting an Excel range into an email as a picture

0 votes

I'm creating an Outlook email from Excel (Office 2013). I want to paste a range of cells (C3:S52) into the email as a picture.

Below is the code I have so far. Where am I going wrong?

 Sub Button193_Click()
 '
 ' Button193_Click Macro
 '

 '
 ActiveWindow.ScrollColumn = 2
 ActiveWindow.ScrollColumn = 1
 Range("C3:S52").Select
 Selection.Copy
 End Sub
 Sub CreateMail()

 Dim objOutlook As Object
 Dim objMail As Object
 Dim rngTo As Range
 Dim rngSubject As Range
 Dim rngBody As Range
 Dim rngAttach As Range

 Set objOutlook = CreateObject("Outlook.Application")
 Set objMail = objOutlook.CreateItem(0)

 With ActiveSheet
 Set rngTo = .Range("E55")
 Set rngSubject = .Range("E56")
 Set rngBody = .Range("E57")
 End With

 With objMail
 .To = rngTo.Value
 .Subject = rngSubject.Value
 .Body = rngBody.Value
 .Display 'Instead of .Display, you can use .Send to send the email _
 or .Save to save a copy in the drafts folder
 End With

 Set objOutlook = Nothing
 Set objMail = Nothing
 Set rngTo = Nothing
 Set rngSubject = Nothing
 Set rngBody = Nothing
 Set rngAttach = Nothing

 End Sub
 Sub Button235_Click()
 '
 ' Button235_Click Macro
 '

 '
 ActiveWindow.ScrollColumn = 2
 ActiveWindow.ScrollColumn = 1
 Range("A1:M27").Select
 Selection.Copy
 End Sub
 Sub RunThemAll()

 Application.Run "Button193_Click"

 Application.Run "CreateMail"

 End Sub 

Mar 25, 2022 in Database by Edureka
• 13,640 points
1,941 views

1 answer to this question.

0 votes
Hold down the ALT + F11 keys to launch the Microsoft Visual Basic for Applications window, then enable the sheet you wish to copy and paste the cells as picture. 2. In the Module Window, choose Insert > Module and paste the following code. Note: You can adjust the body content and email address in the above code to suit your needs.
answered Mar 30, 2022 by gaurav
• 22,940 points

Related Questions In Database

0 votes
1 answer

How can I calculate deciles with a range of 12,000 cells in excel?

1. Enter the following formula in cell ...READ MORE

answered Mar 25, 2022 in Database by gaurav
• 22,940 points
2,863 views
0 votes
1 answer

I have a Run Time Error 91 for an Excel Add In

"Runtime Error 91: Object variable or with ...READ MORE

answered Mar 30, 2022 in Database by gaurav
• 22,940 points
5,760 views
0 votes
1 answer

Merge excel files into a new excel file based on filename

How do I merge Excel files that ...READ MORE

answered Mar 31, 2022 in Database by gaurav
• 22,940 points
790 views
0 votes
1 answer

I have a Run Time Error 91 for an Excel Add In

When there was no unhidden workbook open ...READ MORE

answered Apr 6, 2022 in Database by gaurav
• 22,940 points
277 views
0 votes
1 answer

Number of elements in a single dimension variant array in excel

You must do UBound - LBound + ...READ MORE

answered Mar 24, 2022 in Database by gaurav
• 22,940 points
192 views
0 votes
1 answer

#NAME? error in Excel for VBA Function

Because you have a module with the ...READ MORE

answered Apr 5, 2022 in Database by gaurav
• 22,940 points
262 views
0 votes
1 answer

Excel vba for loop

You must understand how to use loops ...READ MORE

answered Apr 5, 2022 in Database by gaurav
• 22,940 points
169 views
0 votes
0 answers

Unprotect workbook without password

I have a popular VBA code to ...READ MORE

Apr 7, 2022 in Database by Edureka
• 13,640 points
115 views
0 votes
1 answer

How to convert a column number (e.g. 127) into an Excel column (e.g. AA)

If anyone needs to do this in ...READ MORE

answered Mar 30, 2022 in Database by gaurav
• 22,940 points
267 views
0 votes
1 answer

Are there such things as variables within an Excel formula?

Yes. However, not directly. a less complicated method You ...READ MORE

answered Mar 25, 2022 in Database by gaurav
• 22,940 points
92 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP