Hi i have the following macro which sends emails from Excel.
From a workbook, it selects data from the active worksheet and the email address from sheet2, all from rows 2, it then successfully transfers the data accordingly to outlook.
Sub NewEmail()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.from = ""
.to = Worksheets("Sheet2").Range("B2").Value
.CC = ""
.BCC = ""
.Subject = "Operation " & Range("E2") & " Action" '& Range("F3")
.Body = "REF: Action Re " & Range("E2").Text & vbNewLine & vbNewLine & Range("A2") & "," & vbNewLine & vbNewLine & "Please can you progress the following:" & vbNewLine & vbNewLine & Range("F2") & ", " & Range("C2") & vbNewLine & vbNewLine & vbNewLine & "SCS Supervision"
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Is there a way for the macro to offer a pop up box to select:-
kind regards
Lee
From a workbook, it selects data from the active worksheet and the email address from sheet2, all from rows 2, it then successfully transfers the data accordingly to outlook.
Sub NewEmail()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.from = ""
.to = Worksheets("Sheet2").Range("B2").Value
.CC = ""
.BCC = ""
.Subject = "Operation " & Range("E2") & " Action" '& Range("F3")
.Body = "REF: Action Re " & Range("E2").Text & vbNewLine & vbNewLine & Range("A2") & "," & vbNewLine & vbNewLine & "Please can you progress the following:" & vbNewLine & vbNewLine & Range("F2") & ", " & Range("C2") & vbNewLine & vbNewLine & vbNewLine & "SCS Supervision"
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Is there a way for the macro to offer a pop up box to select:-
- one email address from a list of emails from sheet2 in column B
- one relevant row from the active sheet, ie A2, but only cells A2, D2, E2, G2, from within that row which will form the to, subject and body of the email accordingly.
kind regards
Lee