I want to send the worksheet what im working on as PDF in outlook by using VBA, when I test this out it does make an attachment but the PDF file is broken and wont open.. anyone know how to fix this?
Code:
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]Sub saveandsend()[/FONT][/COLOR]
Dim Path As String
Dim filename As String
Path = "DIRECTORY"
filename = Range("P39")
ActiveWorkbook.SaveAs filename:=Path & filename & ".PDF"
' SendEmail Macro
'
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
Dim NewMail As Object
Dim OutlookApp As Object
Dim OutlookMail As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
On Error Resume Next
With OutlookMail
.To = ""
.CC = ""
.BCC = ""
.Subject = Range("X22")
.Body = ""
.Attachments.Add Application.ActiveWorkbook.FullName
.Display
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
[COLOR=#252C2F][FONT=Courier]End Sub[/FONT][/COLOR][COLOR=#252C2F][FONT=Helvetica]