Hello,

I am using some code to send an automated email. I am calling this sub to fill in the email and attach a text file from c:\temp. I cannot quite figure out how to get the code to message back if the file name does not exist in the location specified. Everything else about it works great, I am just stuck on that part of it. Any help would be GREAT and hopefully I am explaining my problem correctly!

Thanks

Sub PickSend()

    Dim OutApp As Object
    Dim OutMail As Object
    Dim GetFile As String
    
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    GetFile = frmMain.TextBox2.Value
    
    On Error Resume Next
    With OutMail
        .to = "someone@mail.com"
        .CC = ""
        .BCC = ""
        .Subject = "Pick & Send parts needed for: " & (frmMain.TextBox1.Value)
        .Body = "ASSEMBLY: " & (frmMain.TextBox2.Value) & vbNewLine & _
        "A Number: " & (frmMain.TextBox1.Value) & vbNewLine & _
        "A Number QTY: " & (frmMain.TextBox16.Value) & vbNewLine & vbNewLine & _
        "Part Numbers Needed in attached Text File"
        
       .Attachments.Add "c:\\temp\\" & (GetFile) & ".txt"
        
        .Display   'or use .Send
        SendKeys "%{s}", True 'send the email without prompts
        MsgBox "Pick & Send notification has been submitted for:  " & (frmMain.TextBox2.Value)
    End With
    On Error GoTo 0
    
    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub