Evening all,
i've nearly cracked this but i'm stuck on the last bit. I need it to send the saved pdf, not the open word doc, any ideas?
i've nearly cracked this but i'm stuck on the last bit. I need it to send the saved pdf, not the open word doc, any ideas?
VBA Code:
Sub SendAsPDF()
Dim strFileName As String
Dim objOutlook As Object
Dim objMailItem As Object
strFileName = Replace(ActiveDocument.FullName, ".docm", ".pdf")
ActiveDocument.SaveAs FileName:= InputBox("enter name") & ".pdf", FileFormat:=wdFormatText, AddToRecentFiles:=False
ActiveDocument.ExportAsFixedFormat OutputFileName:=strFileName, _
ExportFormat:=wdExportFormatPDF
Set objOutlook = CreateObject("Outlook.Application")
Set objMailItem = objOutlook.CreateItem(0) ' 0 = olMailItem
With objMailItem
.Subject = "My Subject"
.Body = "My Message"
.To = "SomeEmailAddress"
.Attachments.Add strFileName
.Display
End With
Kill strFileName
Set objMailItem = Nothing
Set objOutlook = Nothing
End Sub