generate email with range of data in body and attach file

JamRivera

New Member
Joined
Jun 9, 2019
Messages
34
So I am using the following email macro listed below.
I need two macros
one for a report that will attach the report and copy a range (A1:L130) into the body of the email
the second one is for a fax sent via email the fax number will always change
the fax number is always entered in the same cell C7 what doesn't change is is the domain
I need the fax email to do the same as the macro email copy a range and paste into the body of the email
look at C7 copy the fax number and add the domain name sample 4071234567@google.com

Sub CommandButton1_Click()
Dim xOutlookobj As Object
Dim xOutapp As Object
Dim xOutmail As Object
Dim xMailbody As String
On Error Resume Next
Set xOutapp = CreateObject("Outlook.Application")
Set xOutmail = xOutapp.CreateItem(0)
xMailbody = "TEST01 " & vbNewLine & vbNewLine & ""
On Error Resume Next
With xOutmail
.To = "TEST@TESTER.COM"
.CC = ""
.BCC = ""
.Subject = "SECURED MESSAGE"
.Body = xMailbody
.Attachments.Add ActiveWorkbook.FullName
.Display
End With
On Error GoTo 0
Set xOutmail = Nothing
Set xOutapp = Nothing
End Sub

any help will be deeply appreciated :)
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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