Tim Malcolm
asked on
How can I use VBA to create a button to attach the active word doc to an email as a PDF without using outlook as the email client.
Very new to VBA - trying to use a macro to create a "submit" button that will convert the active document to a PDF and attach it to an email in IBM Notes. Most of the resources I've found provide code to perform this operation using Microsoft Outlook as the email client, but I haven't been able to find out much otherwise.
I've had success adding the document to an email in IBM Notes using this code:
Private Sub CommandButton1_Click()
Options.SendMailAttach = True
ActiveDocument.SendMail
End Sub
However, it would be ideal if I could have the document attached as PDF. I was also able to find coding to save the active document as a PDF:
Sub CommandButton1_Click()
ActiveDocument.ExportAsFix edFormat OutputFileName:= _
"C:\Users\example\DocName" , _
ExportFormat:=wdExportForm atPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument , From:=1, To:=1, _
Item:=wdExportDocumentWith Markup, IncludeDocProps:=False, KeepIRM:=True, _
CreateBookmarks:=wdExportC reateNoBoo kmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
End Sub
I'm able to successfully create the PDF document using that code, saving it to the location listed "C:\Users\example\DocName" - I don't really need to keep the document saved as a PDF if I can get it to attach to an email in IBM Notes.
Any help is greatly appreciated!
Thanks!!
I've had success adding the document to an email in IBM Notes using this code:
Private Sub CommandButton1_Click()
Options.SendMailAttach = True
ActiveDocument.SendMail
End Sub
However, it would be ideal if I could have the document attached as PDF. I was also able to find coding to save the active document as a PDF:
Sub CommandButton1_Click()
ActiveDocument.ExportAsFix
"C:\Users\example\DocName"
ExportFormat:=wdExportForm
wdExportOptimizeForPrint, Range:=wdExportAllDocument
Item:=wdExportDocumentWith
CreateBookmarks:=wdExportC
BitmapMissingFonts:=True, UseISO19005_1:=False
End Sub
I'm able to successfully create the PDF document using that code, saving it to the location listed "C:\Users\example\DocName"
Any help is greatly appreciated!
Thanks!!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Solutions