Hello Everyone,
Im looking for a solution for this particular problem right now.
Basically, what I wanted to happen is to have a msgbox prompt if the attachment for the below does not exist.
But, it seems my below code is not working.
Hoping someone would check what I am missing. Thank you
Im looking for a solution for this particular problem right now.
Basically, what I wanted to happen is to have a msgbox prompt if the attachment for the below does not exist.
But, it seems my below code is not working.
Hoping someone would check what I am missing. Thank you
VBA Code:
Private Sub CommandButton2_Click()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = New Outlook.Application
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = Me.txt2.Value
.Subject = "Score Card"
.Body = "Dear " & Me.txt3 & "," & vbCrLf & vbCrLf & "Please find attached of your " & Me.Month.Caption & " Score Card"
.Attachments.Add ("D:\" & Me.ComboBox1 & "_" & Me.txt3 & ".pdf")
.Display
If OutMail.Attachments <> ("D:\" & Me.ComboBox1 & "_" & Me.txt3 & ".pdf") Then
MsgBox "No Attachment currently.", vbExclamation, "Message"
Cancel = True
End If
End With