Email from Excel

Nyge2k3

New Member
Joined
Feb 16, 2015
Messages
11
Hi

I have a list of email addresses in column B of a worksheet called "email contacts", B1 is the heading, so the addresses start in B2.

I'm looking for a macro which opens a new email in Outlook and puts the above list into the "To" section.

I then want to be able to put "This Text" in the subject line and "Hi All" (New Paragraph) "Please find attached......." (New Paragraph) "Regards" in the main body.

Can anyone help?

Thanks
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
See if this works for you.
VBA Code:
Sub Nyge2k3()
Dim OutApp As Object
Dim OutMail As Object
Dim wbTemp As Workbook
Dim strFileName As String
Dim Sendrng As Range
Dim Starttime As Double
Dim Secondselapsed As Double
Dim tolist As String
Dim I As Integer

Starttime = Timer
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.EnableEvents = False
Application.DisplayAlerts = False
ActiveWorkbook.ActiveSheet.Copy
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
tolist = Range("B2").Value
strFileName = ""   'location and name of the file you want to attach.
For I = 3 To 5   'change 5 to the last cell with an email address
    tolist = tolist & ";" & Range("B" & I).Value
Next I
With OutMail
    .To = tolist     'change this email address to the person you want to receive the form
    .CC = ""                            'include anyone you want CC'd
    .BCC = ""                           'include anyone you want BCC'd
    .Subject = "This Text"             'change the subject line to what is appropriate
    .Body = "Hi All" & vbCrLf & "Please find attached......" & vbCrLf & vbCrLf & "Regards, "                         'this is what goes into the body of the email.
    '.Attachments.Add strFileName        'this attaches the file to the email
    .Display                               'use .Send if you want them to send the mail manually
End With
Set wbTemp = Nothing
Set OutApp = Nothing
Set OutMail = Nothing
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
Application.EnableEvents = True
Application.DisplayAlerts = True
Secondselapsed = Round(Timer - Starttime, 2)
MsgBox "This code ran successfully in " & Secondselapsed & " seconds", vbInformation 'can be removed if you don't want to know how long it takes to run.
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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