• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Reg - Mail Automation

jawaharprm

New Member
Hi Friends,

I have a doubt it is possible to Send Files from Excel as attachment in Mail with providing IDS.

In Data for A:E in A coloum i have Names Like "A,B,C" if i click one button "A" data should send mail A Respective Mail IDS the same for B &C it is possible in Excel.

If is possible pls help on Same.


Regards
Jawahar
 

jawaharprm

New Member
Hi,

Thank You for your Replay, i enclosed the sample file for your reference.

if i click "send Mail" button refer the name Jawa "A1:E2" select data and paste in new excel or new sheet and mail to send in given ids.
 

Attachments

Logit

Active Member
Excel 2007 32 bit

A
B
C
D
E
F
G
H
I
J
K
L
1
NamesDataDOJEDUWorkMail ToMail CC
2
JawaPG25/6/2020MSCSQLJ@gmail.com,h@gmail.comD@gmail.com
3
PrabhuPG25/7/2020BSCExcel workJ@gmail.com,h@gmail.com
4
5
6
If you click on this name "Jawa"
7
Then click the SEND MAIL button, you are wanting the data in B2:E2 emailed to addresses in F2 and G2 ?

Sheet: Sheet1
 

VBANoobNotNoob

New Member
I have a similar project that loops through the list, creates emails with the body that includes data in columns A:M using headers like this:

HEADER A: [data from A2]
HEADER B: [data from B2] etc.

After it creates the email, it deletes the row and loops through until all data has been put into an email.

This isn't an exact match of what you're doing, but close enough that you may be able to edit to your liking (had to remove some identifying info for privacy reasons):

Code:
Sub Email_From_Excel_Basic()
' Creating Email

'Looping begins here
   Dim lngLastRow As Long
   Dim lngRow As Long
  
   lngLastRow = Range("A" & Rows.Count).End(xlUp).Row
   For lngRow = 2 To lngLastRow
    
'Gathering email data begins here
Dim emailApplication As Object
Dim emailItem As Object
Dim strbody As String
Dim strfrom As String
With ThisWorkbook.Sheets("SHEETNAME")
 strbody = "Below is information regarding your SUBJECT MATTER for:" & vbNewLine & vbNewLine & _
                  .Range("A1") & " : " & .Range("$A$2") & vbNewLine & _
                  .Range("B1") & " : " & .Range("$B$2") & vbNewLine & _
                  .Range("C1") & " : " & .Range("$C$2") & vbNewLine & _
                  .Range("D1") & " : " & .Range("$D$2") & vbNewLine & _
                  .Range("E1") & " : " & .Range("$E$2") & vbNewLine & _
                  .Range("F1") & " : " & .Range("F$2") & vbNewLine & _
                  .Range("G1") & " : " & .Range("G$2") & vbNewLine & _
                  .Range("H1") & " : " & .Range("H$2") & vbNewLine & _
                  .Range("I1") & " : " & .Range("I$2") & vbNewLine & _
                  .Range("j1") & " : " & .Range("J$2") & vbNewLine & _
                  .Range("k1") & " : " & .Range("K$2") & vbNewLine & _
                  .Range("l1") & " : " & .Range("L$2") & vbNewLine & _
                  .Range("m1") & " : " & .Range("M$2")
                  End With
 
Set emailApplication = CreateObject("Outlook.Application")

Set emailItem = emailApplication.CreateItem(0)

' Creating the actual email.

emailItem.To = Range("O$2").Value

emailItem.Subject = "EMAIL SUBJECT HERE"

emailItem.Body = strbody

emailItem.SentOnBehalfOfName = "you@youremail.com"

' Send the Email
' Use .send this OR .Display, but not both together.
emailItem.Display
'emailItem.Send

Set emailItem = Nothing
Set emailApplication = Nothing

 Rows(2).EntireRow.Delete

   Next lngRow

End Sub
 
Top