vba - Print mail item as pdf -
i attempting save of mail items within folder in outlook pdf.
sub pdfconversion() dim outapp object, objoutlook object, objfolder object, myitems object, myitem object dim psname string, pdfname string set outapp = createobject("outlook.application") set objoutlook = outapp.getnamespace("mapi") set objfolder = objoutlook.getdefaultfolder(olfolderinbox).folders("pdf conversion") set myitems = objfolder.items each myitem in myitems myitem.printout copies:=1, preview:=false, activeprinter:="adobe pdf", printtofile:=true, _ collate:=true, prtofilename:="c:\users\lturner\documents\" & myitem.subject & ".pdf" next myitem end sub
i using outlook 2007, doesn't have option save mails pdf, hence i'm attempting use .printout
method.
using above receiving "named argument not found" error. i've looked elsewhere on internet, cannot seem find solution.
mailitem.printout
doesnt take paramters. uses application level default settings.
the workaround can think here 2 step,
step 1 use mailitem.saveas "somefile.doc", oldoc
convert rtf or document
step 2 using word automation, (reference word objects 14.0) convert pdf using fixedformat.
document.exportasfixedformat "somefile.pdf", 17
Comments
Post a Comment