I am trying to run a if statement to send an email if the sub has run and is successful.
The current code I am trying is
Private Sub SendButton_Click()
Call Populate
If Populate = True Then
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveDocument
Doc.Save
With EmailItem
.Subject = "New ePRF Available"
.Body = "I have completed a new e-PRF"
.To = ""
.Importance = olImportanceNormal
.attachments.Add Doc.FullName
.Send
End With
Application.ScreenUpdating = True
Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing
Else
Call Populate
End If
End Sub
This is something I have never really done before so am very confused! Any help would be grateful!
Thanks