Written by Allen Wyatt (last updated January 3, 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.
Do More in Less Time! An easy-to-understand guide to the more advanced features available in the Microsoft 365 version of Word. Enhance the quality of your documents and boost productivity in any field with this in-depth resource. Complete your Word-related tasks more efficiently as you unlock lesser-known tools and learn to quickly access the features you need. Check out Microsoft 365 Word For Professionals For Dummies today!
When you attempt to open a file in Word, chances are good that you will first have to pass through what is called the ...
Discover MoreTags are a way for you to store keywords or metadata with your document files. They can be helpful when you are trying to ...
Discover MoreWhen you receive documents via e-mail, opening those documents may invoke a Word feature called Protected View. If this ...
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