My user wants to look at every email before it goes out so she needs the .Display option. The problem is that I cannot clear the attachments between emails.
I have tried:
Set OutMail = Nothing
Set OutApp = Nothing
The user would like to just hit the Send button instead of having the program send the email.
How do I clear the previous attachments?
Code:
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
Debug.Print wsEmail.Cells(lngEmlRow, intEmail)
.To = "testuser@domain.com"
.CC = ""
.BCC = ""
.Subject = strSubject
If InStr(1, wsEmail.Cells(lngEmlRow, intCustName), " ") > 0 Then
.Body = "Hello " & Trim(Left(wsEmail.Cells(lngEmlRow, intCustName), _
InStr(1, wsEmail.Cells(lngEmlRow, intCustName), " "))) & "," & vbLf & varBodyText.Value
Else
.Body = "Hello " & Trim(wsEmail.Cells(lngEmlRow, intCustName)) & "," & vbLf & varBodyText.Value
End If
.attachments.DeleteAll
.attachments.Add (strSavePath & "\" & strCurFile)
.attachments.Add (strPDFPath)
.Display
'intResponse = MsgBox("Send message now and clear attachments?", vbOKOnly, "SEND MESSAGE")
'If intResponse = 1 Then
' .Send
'End If
End With
On Error GoTo 0
I have tried:
Set OutMail = Nothing
Set OutApp = Nothing
The user would like to just hit the Send button instead of having the program send the email.
How do I clear the previous attachments?