Okay but keep in mind if you want to look at each email before they go out and you have 100+ emails you will have 100+ emails generated and stay open until you either send them or the macro crashes or the computer due to the large amount of emails open. This macro is not finished as you are missing a spot for the email address, subject, body, you have to save your document in a certain directory then copy that directory onto the macro since I don't know its location. This however will not put the body of the email as the word document you presented but will attached the word document you presented with the appropriate information you mentioned where is should go. Let me know if we have begun down the right track here.
Sub ifthensend()
Dim wApp As Word.Application
Dim wDoc As Word.Document
Dim DtRNG As Range, Dt As Range
Dim OutApp As Object
Dim OutMail As Object
Set DtRNG = Sheets("Sheet1").Range("J:J").SpecialCells(xlConstants)
For Each Dt In DtRNG
If Dt = "Yes" Then
Let I = Dt.Row
Let ID = Range("G" & I & "")
Let Program = Range("B" & I & "")
Let Root = Range("E" & I & "")
Let Action = Range("F" & I & "")
Let resolv = Range("I" & I & "")
Set wApp = CreateObject("word.application")
wApp.Visible = True
'Set wDoc = wApp.Documents.Add ' to add a brand new document instead
wApp.Documents.Open "C:\.docx" 'put your directory and document name and extension here
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection.Delete Unit:=wdCharacter, Count:=1
wApp.Selection = "Issue: " & ID & ""
wApp.Selection.MoveRight Unit:=wdCell
wApp.Selection = "Root cause: " & Root & ""
wApp.Selection.MoveRight Unit:=wdCell
wApp.Selection = "Action: " & Action & ""
wApp.Selection.MoveRight Unit:=wdCell
wApp.Selection = "Resolver: " & resolv & ""
Application.DisplayAlerts = False
wApp.Documents.Save
wApp.Quit
Application.DisplayAlerts = True
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = ""
.Body = ""
.Attachments.Add ("C:\.docx") 'put your directory and document name and extension here
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
Next Dt
End Sub
Bookmarks