Macro to send email and send screen shot

bthumble

Board Regular
Joined
Dec 18, 2007
Messages
231
Want to modify my macro to send a screen shot as part of the body of the email. The screen shot is on a different tab than the input for To, Subject and Body in the VBA code. Would like to be able to adjust the range for the screen shot since it changes frequently. Thanks for your asisstance.


Sub send_email()

Dim OutApp As Object
Dim Outmail As Object
Set OutApp = CreateObject("Outlook.Application")
Set Outmail = OutApp.CreateItem(0)

With Outmail
.To = Range("C3").Value
.Subject = Range("C5").Value
.Body = Application.WorksheetFunction.TextJoin(vbNewLine, True, Range("C7:C13").Value)

.display
End With

Set Outmail = Nothing
Set OutApp = Nothing

End Sub
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Here is a thread worth looking at,
there are other threads on this as well.
 
Upvote 0
I am using the VBA script from site Excel Automation - Ron de Bruin and want both text above and below the HTMLBody. Currently only the HTMLBody appears on the email. What have I done incorrectly? Below is the section of the code where I specify the inputs that go in the email. Thanks.

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

On Error Resume Next
With OutMail
.To = Range("C3").Value
.CC = Range("C5").Value
.BCC = Range("C7").Value
.Subject = Range("C9").Value
.StrBody = Sheets("Sheet1").Range("C11").Value & "<br>" & _
Sheets("Sheet1").Range("C12").Value & "<br><br><br>"
.HTMLBody = StrBody & RangetoHTML(rng)

'.Send 'or use .Display
.Display
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,082
Messages
6,128,709
Members
449,464
Latest member
againofsoul

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