Send selected Range cell in body and using outlook signature

Lv4games

New Member
Joined
Oct 7, 2016
Messages
17
[FONT=&quot]Hello everyone,[/FONT]
[FONT=&quot]I have this VBA code which works great, I am trying to include rage selection. So in order words I want it work like the Sub send selection code. How to I incorporate the sub selection code with the below code.[/FONT]
[FONT=&quot]Sub Send_Email_With_Signature()
[/FONT]

[FONT=&quot]Dim objOutApp As Object, objOutMail As Object[/FONT]
[FONT=&quot]Dim strBody As String, strSig As String[/FONT]
[FONT=&quot]Set objOutApp = CreateObject("Outlook.Application")[/FONT]
[FONT=&quot]Set objOutMail = objOutApp.CreateItem(0)[/FONT]
[FONT=&quot]On Error Resume Next[/FONT]
[FONT=&quot]
[/FONT]

[FONT=&quot]With objOutMail[/FONT]
[FONT=&quot]'SET THE EMAIL CONDITIONS[/FONT]
[FONT=&quot].To = "rick@morty@ctr"[/FONT]
[FONT=&quot].CC = ""[/FONT]
[FONT=&quot].BCC = ""[/FONT]
[FONT=&quot].Subject = "Subject Line"[/FONT]
[FONT=&quot]'ADD ATTACHMENTS[/FONT]
[FONT=&quot]'.Attachments.Add ("C:\Users\FormatCells\Documents\MyTestDoc.txt")[/FONT]
[FONT=&quot]'IF SENT FROM ANOTHER EMAIL ACCOUNT (MUST ALREADY BE SETUP)[/FONT]
[FONT=&quot]'.SentOnBehalfOfName = "AnotherAccount@FormatCells.com"[/FONT]
[FONT=&quot]'CHECK NAMES, ENSURES INTERNAL EMAIL ADDRESSES EXISTS IN ADDRESS BOOK[/FONT]
[FONT=&quot].Recipients.ResolveAll[/FONT]
[FONT=&quot]'DO NOT REMOVE - THIS MUST BE VISIBLE FIRST TO GET THE DEFAULT SIGNATURE[/FONT]
[FONT=&quot].Display[/FONT]
[FONT=&quot]'GET THE HTML CODE FROM THE SIGNATURE[/FONT]
[FONT=&quot]strSig = .Htmlbody[/FONT]
[FONT=&quot]'WHAT SHOULD THE EMAIL SAY, ON TOP OF THE SIGNATURE[/FONT]
[FONT=&quot]'HTML TAGS CAN BE INCLUDED HERE[/FONT]
[FONT=&quot].strBody = "Sendrng = Selection"[/FONT]
[FONT=&quot]'COMBINE THE EMAIL WITH THE SIGNATURE[/FONT]
[FONT=&quot].Htmlbody = strBody & strSig[/FONT]
[FONT=&quot]'IF YOU DO NOT HAVE HTML IN THE BODY, USE THIS INSTEAD[/FONT]
[FONT=&quot]'.Body = strBody & strSig[/FONT]
[FONT=&quot]'AUTOMATICALLY SEND EMAIL (IT WILL STILL BRIEFLY POPUP)[/FONT]
[FONT=&quot]'.Send[/FONT]
[FONT=&quot]End With[/FONT]
[FONT=&quot]On Error GoTo 0[/FONT]
[FONT=&quot]Set objOutMail = Nothing[/FONT]
[FONT=&quot]Set objOutApp = Nothing[/FONT]
[FONT=&quot]
[/FONT]

[FONT=&quot]End Sub[/FONT]
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,214,956
Messages
6,122,465
Members
449,085
Latest member
ExcelError

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