nianchi111
Board Regular
- Joined
- Aug 24, 2007
- Messages
- 197
- Office Version
- 365
Hi All,
I found a code to send email, this takes all the email address only from column A and displays it in TO address as email ID1; eamil ID2; till last mail ID.
Sub Outlook_Email()
'Setting up the Excel variables.
Dim olApp As Object
Dim olMailItm As Object
Dim iCounter As Integer
Dim Dest As Variant
Dim SDest As String
'Create the Outlook application and the empty email.
Set olApp = CreateObject("Outlook.Application")
Set olMailItm = olApp.CreateItem(0)
'Using the email, add multiple recipients, using a list of addresses in column A.
With olMailItm
SDest = ""
For iCounter = 1 To WorksheetFunction.CountA(Columns(1))
If SDest = "" Then
SDest = Cells(iCounter, 1).Value
Else
SDest = SDest & ";" & Cells(iCounter, 1).Value
End If
Next iCounter
'Do additional formatting on the BCC and Subject lines, add the body text from the spreadsheet, and send.
'.BCC = SDest
.To = SDest
.Subject = "FYI"
.Body = ActiveSheet.TextBoxes(1).Text
.Attachments.Add ("C:\Users\sks148\Desktop\vimal - DO NOT DELETE\Mexico Statements123\Picture1.png")
.Display
' .Send
End With
'Clean up the Outlook application.
Set olMailItm = Nothing
Set olApp = Nothing
End Sub
What I require:
Column A B C D E
Names1 na@dot.com ma@dot.com
Name2 12@g.com 24@g.come 43@g.com 244@g.com
Name3 nanak@y.com
Something similar to the above table,. for some cases i have email address till column H.
For example for Name2 its has to be 12@g.com; 24@g.com; 43@g.com; 244@g.com in the TO address.
Thanks,
Vimal Vikraman.
I found a code to send email, this takes all the email address only from column A and displays it in TO address as email ID1; eamil ID2; till last mail ID.
Sub Outlook_Email()
'Setting up the Excel variables.
Dim olApp As Object
Dim olMailItm As Object
Dim iCounter As Integer
Dim Dest As Variant
Dim SDest As String
'Create the Outlook application and the empty email.
Set olApp = CreateObject("Outlook.Application")
Set olMailItm = olApp.CreateItem(0)
'Using the email, add multiple recipients, using a list of addresses in column A.
With olMailItm
SDest = ""
For iCounter = 1 To WorksheetFunction.CountA(Columns(1))
If SDest = "" Then
SDest = Cells(iCounter, 1).Value
Else
SDest = SDest & ";" & Cells(iCounter, 1).Value
End If
Next iCounter
'Do additional formatting on the BCC and Subject lines, add the body text from the spreadsheet, and send.
'.BCC = SDest
.To = SDest
.Subject = "FYI"
.Body = ActiveSheet.TextBoxes(1).Text
.Attachments.Add ("C:\Users\sks148\Desktop\vimal - DO NOT DELETE\Mexico Statements123\Picture1.png")
.Display
' .Send
End With
'Clean up the Outlook application.
Set olMailItm = Nothing
Set olApp = Nothing
End Sub
What I require:
Column A B C D E
Names1 na@dot.com ma@dot.com
Name2 12@g.com 24@g.come 43@g.com 244@g.com
Name3 nanak@y.com
Something similar to the above table,. for some cases i have email address till column H.
For example for Name2 its has to be 12@g.com; 24@g.com; 43@g.com; 244@g.com in the TO address.
Thanks,
Vimal Vikraman.