Hello,
I have code that works fine for looking at how many rows have values and sending email for each one. What I need to do now is adjust it so that I can enter a start row, and a stop row and only have it process those. For example, may have content in 600 rows but only want to send emails for 56-90 right now.
I have code that works fine for looking at how many rows have values and sending email for each one. What I need to do now is adjust it so that I can enter a start row, and a stop row and only have it process those. For example, may have content in 600 rows but only want to send emails for 56-90 right now.
VBA Code:
Sub TESTI9EmailsforAllinI9NewFolksList()
' Don't forget to copy the function GetBoiler in the module.
' Working in Office 2000-2016
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim SigString As String
Dim Signature As String
Dim ws As Worksheet
Dim Rw As Long
strbody = ""
'Change only Mysig.htm to the name of your signature
SigString = Environ("appdata") & _
"\Microsoft\Signatures\Signature.htm"
If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If
On Error Resume Next
source_file = {ACTUAL FILE PATH}
Set ws = Sheets("I9 New Folks")
For Rw = 2 To Range("B" & Rows.Count).End(xlUp).Row
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = Sheets("I9 New Folks").Range("D" & Rw).Text
.CC = ""
.Subject = Sheets("I9 New Folks").Range("B" & Rw).Text & " " & Sheets("I9 New Folks").Range("C" & Rw).Text & " (" & Sheets("I9 New Folks").Range("E" & Rw).Text & "), Your action is needed on your I-9 Form - SD: " & Sheets("I9 New Folks").Range("X" & Rw).Text
.HTMLBody = Signature
.Attachments.Add source_file
.Display
End With
Next Rw
On Error GoTo 0
Set objAppt = Nothing
Set objOL = Nothing
End Sub