In Word 2010, the only way to save word doc (.docx) and publish it as pdf (pdf preview) is as follows :
File > Save & Send > Create PDF/XPS Document > Create PDF/XPS > Publish
Above series of clicks opens a window titled 'Publish as PDF or XPS' with original file name but file type as PDF (in the same path or directory as original .docx file).
I recorded a macro using the series of steps above by opening a blank doc1.docx file. The macro runs perfectly well. My problem is that when i run this macro on any other word file it still ends up at c:user/documents directory as doc1.pdf. I would like the macro to create pdf file with same file name and in the same directory and show the pdf preview (as the series of clicks above does it). Can someone help?
(File > Save as > PDF does not publish or bring up the pdf preview but simply saves it to the same directory with same file name but pdf extension)
The VBA code generated in my macro is:
Code:
Sub pdf()
' pdf Macro
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
"C:\Users\username\Documents\Doc1.pdf", ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=True, OptimizeFor:=wdExportOptimizeForPrint, Range:= _
wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _
IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _
True, UseISO19005_1:=False
End Sub
I would appreciate any help or hopefully a VBA code (macro) that would save the .docx file, convert it to .pdf with same file name and publish (pdf preview).
Thanks in advance
(Since i am posting first time here - i dont know if the replies will be sent to my email or i have to access the forum everytime or if i can give my email address here in the post?)