I have a code which on pressing command button, it opens email and attaches a file from my computer.
If it does not find the file, I get a halt error, "cannot find this file". Is there a way to build into the code to continue to sending the email even if the file is not found/attached?
---------------
Private Sub Command581_Click()
Dim strFileName As String
Dim rst As DAO.Recordset
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
FileName = "G:\CCSG Physicians\1 - Physicians - CV's & Interview Itineraries\CV's" & [Text579] & " CV.pdf"
With MailOutLook
.To = "janedoe@aol.com"
.Subject = "New Hire Offer Made"
.Attachments.Add FileName
.Display
End With
End Sub
---------------
If it does not find the file, I get a halt error, "cannot find this file". Is there a way to build into the code to continue to sending the email even if the file is not found/attached?
---------------
Private Sub Command581_Click()
Dim strFileName As String
Dim rst As DAO.Recordset
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
FileName = "G:\CCSG Physicians\1 - Physicians - CV's & Interview Itineraries\CV's" & [Text579] & " CV.pdf"
With MailOutLook
.To = "janedoe@aol.com"
.Subject = "New Hire Offer Made"
.Attachments.Add FileName
.Display
End With
End Sub
---------------