bsharath
asked on
Send mails to users in the excel with the data below.
Hi,
Send mails to users in the excel with the data below.
very identical to this post
https://www.experts-exchange.com/questions/23843771/Excel-sheet-need-to-send-mail-to-users-in-colum-A-with-the-B-C-data-in-the-body-of-each-mail.html?cid=239&anchorAnswerId=22796431#a22796431
Sample attached.
Regards
Sharath
Sample-Groups-mails.xls
Send mails to users in the excel with the data below.
very identical to this post
https://www.experts-exchange.com/questions/23843771/Excel-sheet-need-to-send-mail-to-users-in-colum-A-with-the-B-C-data-in-the-body-of-each-mail.html?cid=239&anchorAnswerId=22796431#a22796431
Sample attached.
Regards
Sharath
Sample-Groups-mails.xls
ASKER
Perfect but i want all that you gave me in the other post.
The grid lined
Body
The footer
The grid lined
Body
The footer
ASKER
Perfect but i want all that you gave me in the other post.
The grid lined
Body
The footer
The grid lined
Body
The footer
like so?
Cheers
Dave
Cheers
Dave
Option Explicit
Sub ManagerMail()
Dim rng1 As Range, rng2 As Range, cel As Range
Dim doit
Set rng1 = Sheets(1).Range([a1], Cells(ActiveSheet.Rows.Count, "A").End(xlUp)).SpecialCells(xlConstants)
For Each cel In rng1
If cel.Font.Bold Then
If cel.Offset(2, 0) = vbNullString Then
Set rng2 = cel.Offset(1, 0)
Else
Set rng2 = Range(cel.Offset(1, 0), cel.Offset(1, 0).End(xlDown))
doit = Mailem(cel.Value, rng2)
End If
End If
Next
End Sub
Function Mailem(Recip As String, BodyText As Range)
Dim outApp, outMail
Dim tempStrStart As String, tempStrMid As String, tempStrFinish As String, tempStr As String
Dim cel As Range
Set outApp = CreateObject("Outlook.Application")
tempStrStart = "<table border=1>"
tempStrFinish = "</table>"
For Each cel In BodyText
tempStrMid = tempStrMid & "<tr><td>" & cel.Value & "</td>"
Next
tempStr = tempStrStart & tempStrMid & tempStrFinish
outApp.Session.Logon
Set outMail = outApp.CreateItem(0)
With outMail
.To = Recip
.Subject = "Groups"
.htmlBody = "Hi " & Recip & ",<br>Below is the data.<br>" & tempStr & "<br><br>Regards<br>Sharath"
.Recipients.ResolveAll
.Display
End With
Set outMail = Nothing
Set outApp = Nothing
End Function
ASKER
Works perfect Dave but need a header as
"Groups"
Below is all the data in borders.
"Groups"
Below is all the data in borders.
ASKER
"Below is the data."
i dont get a line empty
I get the body as this
Hi sharathr,
Below is the data. (NEED A SPACE BETWEEN THESE LINES)
Products-SGW
Pi Document Templates-SGW
Bacog-SGW
Regards
Sharath
i dont get a line empty
I get the body as this
Hi sharathr,
Below is the data. (NEED A SPACE BETWEEN THESE LINES)
Products-SGW
Pi Document Templates-SGW
Bacog-SGW
Regards
Sharath
ASKER
Dave similar type of Q here which i need to send managers the user names who have internet...
https://www.experts-exchange.com/questions/23845484/Filter-colum-'F-and-send-the-user-a-mail-with-the-details.html
https://www.experts-exchange.com/questions/23845484/Filter-colum-'F-and-send-the-user-a-mail-with-the-details.html
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect Dave thank U...
the same output in the above link too please...
the same output in the above link too please...
It sends an email to the person in bold, listing the names of the groups directly below the bold cell
Cheers
Dave
Open in new window