PugradorTX
New Member
- Joined
- Sep 15, 2023
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
Not a VBA expert, AT ALL. I searched for a code to automatically send emails from Excel through Outlook. However, is there a way to stop the code from automatically sending them, and instead create the email pop-up and if all looks good, then I manually click Send?
VBA Code:
Sub Send_Bulk_Mails()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("TESTING")
Dim i As Integer
Dim OA As Object
Dim msg As Object
Set OA = CreateObject("outlook.application")
Dim last_row As Integer
last_row = Application.CountA(sh.Range("A:A"))
For i = 2 To last_row
Set msg = OA.createitem(0)
msg.to = sh.Range("A" & i).Value
msg.cc = sh.Range("B" & i).Value
msg.Subject = sh.Range("C" & i).Value
msg.body = sh.Range("D" & i).Value
If sh.Range("E" & i).Value <> "" Then
msg.attachments.Add sh.Range("E" & i).Value
End If
msg.send
sh.Range("F" & i).Value = "Sent"
Next i
MsgBox "All emails have been sent"
End Sub