Send selected Range cell in body and using outlook signature

Lv4games

New Member
Joined
Oct 7, 2016
Messages
7
[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]
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Watch MrExcel Video

Forum statistics

Threads
1,090,452
Messages
5,414,615
Members
403,536
Latest member
JEduardo

This Week's Hot Topics

Top