Trevor3007
Well-known Member
- Joined
- Jan 26, 2017
- Messages
- 675
- Office Version
- 365
- Platform
- Windows
hello ,
i use the following email template :-
However, i want it to prompt a 'choice' so i can use another email template ( its just few different amendments from the above code) which I can sort after some canny person can sort out the y/n option 1st?
MTIA
Trevor3007
i use the following email template :-
Code:
Option Explicit
Sub PC_Email()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim MailAttachments As String
Dim cell As Variant ' Not previously DIM'd
Sheets("Sheet1").Select ' Edit as required
Range("A1").Select
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup
If WorksheetFunction.CountA(Range("K2:K100")) = 0 Then
MsgBox "To send email, please enter an X in Column K.", vbCritical, "Missing Entry"
Exit Sub
End If
For Each cell In Columns("C").Cells
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "K").Value) <> "" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
strbody = "Please Delete Any Previous Emails Related To This Period" & vbNewLine & vbNewLine & _
"Good Morning, " & vbNewLine & vbNewLine & _
"Please find attached applicable time sheet / expense's / receipts for WC: " & Cells(cell.Row, "A") & vbNewLine & vbNewLine & _
" " & Cells(cell.Row, "F") & " timesheet to be paid " & Cells(cell.Row, "G") & vbNewLine & vbNewLine & _
"KR" & vbNewLine & vbNewLine & _
"me" & vbNewLine & vbNewLine & _
"you" & vbNewLine & vbNewLine & _
"12344678"
.To = Cells(cell.Row, "C").Value
.CC = Cells(cell.Row, "D").Value
.BCC = Cells(cell.Row, "E").Value
.Subject = "Timesheet & Expenses Claim For WC " & Cells(cell.Row, "A").Value
.Body = strbody
'.Attachments.Add Application.ActiveWorkbook.FullName
.Attachments.Add ActiveSheet.Cells(cell.Row, "H").Value
.Attachments.Add ActiveSheet.Cells(cell.Row, "I").Value
.Attachments.Add ActiveSheet.Cells(cell.Row, "J").Value
.Display 'Or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
However, i want it to prompt a 'choice' so i can use another email template ( its just few different amendments from the above code) which I can sort after some canny person can sort out the y/n option 1st?
MTIA
Trevor3007
Last edited by a moderator: