MACRO TO SAVE AS PDF IN WORD 2010

Are any macros available to do a Save As and save as PDF? I tried to create one myself but got stuck at the point where you have to enter a file name. All help appreciated.

 

Arlene

Answer
Answer
Graham's macro doesn't display a dialog; it just saves the document with its current path and document name but in PDF format. It does what you described in your original post.

With your additional description of what you want to do, the code you need is only this:

    With Dialogs(wdDialogFileSaveAs)
        .Format = wdFormatPDF
        .Show
    End With

You can put this in a macro with some otherwise unused name, such as Sub SaveAsPDF(), and create a button on the Quick Access Toolbar or in a custom ribbon group to run it.
_____________________________
https://jay-freedman.info

3 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Answer
Answer
Is this not re-inventing the wheel? File > SaveAs > PDF will do the job without a macro.
However if you insist -

Dim strName As String
ActiveDocument.Save
strName = Left(ActiveDocument.FullName, Len(ActiveDocument.FullName) - 4)
strName = strName & "pdf"
ActiveDocument.ExportAsFixedFormat OutputFileName:=strName, _
                                   ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
                                   wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, to:=99, _
                                   Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
                                   CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
                                   BitmapMissingFonts:=True, UseISO19005_1:=True

will do the job - http://www.gmayor.com/installing_macro.htm
Graham Mayor (Microsoft Word MVP 2002-2019)
For more Word tips and downloads visit my web site
https://www.gmayor.com/Word_pages.htm

2 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated April 5, 2023 Views 14,569 Applies to: