![]() |
Compile Error sending pdf as attachment
I think i may have deleted a part of code ina module to now cause a Compile
Error. The error is: "Sub or Fuction Not Defined." The error line is highlighted in the code below. Can some help me fix this? Sub SendPDF() Dim OutApp As Object Dim OutMail As Object With Application .ScreenUpdating = False .EnableEvents = False End With Set OutApp = CreateObject("Outlook.Application") OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) With OutMail .To = Sheet1.Range("B13").Value .CC = Sheet1.Range("B15").Value .BCC = "" .Subject = Sheet1.Range("B63").Value .Body = Sheet1.Range("B65").Value If Not FileExists("\\Server\Pdf's\" & Range("G5").Value & ".pdf") Then ' <=== ERROR MsgBox "The pdf file doesn't exist! " & "Please check the pdf File Name you just saved" & vbCrLf & vbCrLf & "It MUST be saved as " & Sheet1.Range("G5").Value & " ONLY!", vbCritical, "...." Exit Sub Else .Attachments.Add ("\\Server\Pdf's\" & Range("G5").Value & ".pdf") End If .send End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing With Application .ScreenUpdating = True .EnableEvents = True End With Sheet1.Range("B64").Value = Time & Date Sheets("Information").Range("B64").Value = Format(Sheets("Information").Range("B64").Value, "hh:mmAM/PM dddd dd mmmm yyyy ") Sheet1.Protect End Sub -- Corey .... The Silliest Question is generally the one i forgot to ask. |
All times are GMT +1. The time now is 08:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com