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.
Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2021 or Microsoft 365. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word Step by Step today!
Some people use their computers for little else, other than to work on Word documents. If that is the case with you, then ...
Discover MoreUsing both Word and Windows, there are a variety of ways you can mark a file as read-only so that it cannot be changed. ...
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 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