Saving word doc as pdf file and send it as attachement
I was wondering if there's a macro that convert word doc to pdf file and send it as attachement through e-mail.
I am using the following code to send a word doc but how do I make it save the word doc as pdf file and send it as pdf?
[VBA]Sub SendDocumentAsAttachment()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
'You'll need to add the Outlook Object Library to VBA Tools References
Dim oItem As Outlook.MailItem
On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then 'Document has not been saved
ActiveDocument.Save 'so save it
End If
'see if Outlook is running and if so turn your attention there
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then 'Outlook isn't running
'So fire it up
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
'Open a new e-mail message
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem 'and add the detail to it
.To = "" 'send to this address
.CC = ""
'.BCC = ""
.Subject = " per " & Format(Now, "dd-mmm-yyyy-hh-mm-ss") 'This is the message subject
.Body = Mailbody
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue
.Display
End With
If bStarted Then 'If the macro started Outlook, stop it again.
oOutlookApp.Quit
End If
'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
Sub SaveAsDate()
ChangeFileOpenDirectory ""
ActiveDocument.SaveAs FileName:="x" & "-" & Format(Now, "dd-mmm-yyyy-hh-mm-ss") & ".doc"
End Sub
[/VBA]