Written by Allen Wyatt (last updated January 2, 2026)
This tip applies to Word 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365
Ann regularly converts legal briefs prepared in Word to PDFs for electronic filing, and court rules require all headings to be bookmarked in the PDFs. Occasionally she forgets to set the options to bookmark the headings. Ann wonders if there is a way to set this option as a default within Word.
There is not a way to specify this setting as a default, but you can create a macro that will save the PDF file with the setting handled the way that Ann prefers. Here is a rather simple macro to accomplish the task:
Sub SavePDFBookmarks()
Dim FDia As FileDialog
Dim pdfPath As String
Dim sPath As String
Dim sName As String
With ActiveDocument
sPath = Options.DefaultFilePath(wdDocumentsPath)
If Len(.Path) > 0 Then sPath = .Path
sPath = sPath & Application.PathSeparator
sName = Left(.Name, InStr(.Name, ".") - 1)
sName = sName & ".pdf"
Set FDia = Application.FileDialog(msoFileDialogSaveAs)
FDia.InitialFileName = sPath & sName
If FDia.Show = -1 Then
pdfPath = FDia.SelectedItems(1)
.ExportAsFixedFormat _
OutputFileName:=pdfPath, _
ExportFormat:=wdExportFormatPDF, _
CreateBookmarks:=wdExportCreateHeadingBookmarks
End If
End With
End Sub
The macro determines the proper path for the PDF file (it defaults to the same path as used by the active document) and determines a new filename that has a PDF extension. It then displays the Save As dialog box so that the user can, if desired, choose a different location for the PDF file. When the user clicks OK in the dialog box, the document is saved as a PDF file with bookmarks formed from headings in the document.
There are a few cases where the macro could run into problems. For instance, if the active document doesn't have a filename extension or if the filename contains multiple periods. The macro, as written, works perfectly if there is only a single period between the base filename and the filename extension, but can produce wonky results if that is not the case.
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (10056) applies to Microsoft Word 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.
The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2019. Spend more time working and less time trying to figure it all out! Check out Word 2019 For Dummies today!
If you need to make sure that the fonts in your document can be used by another person or on a different system, you'll ...
Discover MoreIf you work with a lot of documents at the same time, it can be difficult to remember the folder in which any given ...
Discover MoreIf you want to print a group of documents at the same time, there are a couple of ways you can accomplish the task. Here ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2026 Sharon Parq Associates, Inc.
Comments