Hi Jeremy,
Thank you for reaching out to Microsoft Community. We're happy to help you with your concern.
It's a frequent workflow pain when Word's built-in document properties, especially the Title, get unintentionally reused in PDFs exported from templates. Let's walk through both of your questions with clear solutions:
Goal 1: Automatically Set Word Document "Title" to Match Filename
- Word stores the "Title" in File > Info > Properties, and this gets embedded in exported PDFs unless removed.
- To automatically update the Title to match the Filename, you can use a simple VBA macro:
Macro: Set Title = Filename
Sub UpdateTitleWithFilename()
Dim doc As Document
Set doc = ActiveDocument
' Get filename without extension
Dim fileName As String
fileName = Left(doc.Name, InStrRev(doc.Name, ".") - 1)
' Update the Title property
doc.BuiltInDocumentProperties("Title").Value = fileName
End Sub
To Set This Up:
- Press
Alt + F11 in Word to open the VBA editor.
- Insert → Module.
- Paste the macro above.
- Save the macro-enabled template as
.dotm (so it works for new documents).
- (Optional) You can even call this macro on document save or export for automation.
If you want to automate this every time you save the document, you can hook it to the DocumentBeforeSave event via ThisDocument or create a macro-enabled template that includes this logic.
Goal 2: PDF Export Without Using "Title" Metadata (Use Filename Instead)
You're absolutely right — when exporting a Word doc to PDF:
- If File > Info > Properties > Title is filled, that gets used as the PDF title.
- If you uncheck “Document properties” in the export dialog, the PDF uses the filename instead.
There's no built-in Word setting to make “exclude document properties” the default.
Workaround: Export via Macro with Correct Settings
Here’s a macro that exports to PDF and automatically unchecks “Document Properties”:
Sub ExportToPDF_WithoutProperties()
Dim filePath As String
filePath = ActiveDocument.Path & "\" & _
Left(ActiveDocument.Name, InStrRev(ActiveDocument.Name, ".") - 1) & ".pdf"
ActiveDocument.ExportAsFixedFormat OutputFileName:=filePath, _
ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=False, _
OptimizeFor:=wdExportOptimizeForPrint, _
Range:=wdExportAllDocument, _
Item:=wdExportDocumentContent, _
IncludeDocProps:=False, _
KeepIRM:=True, _
CreateBookmarks:=wdExportCreateHeadingBookmarks, _
DocStructureTags:=True, _
BitmapMissingFonts:=True, _
UseISO19005_1:=False
End Sub
I hope these solutions can help you to solve this issue. Please know that we truly appreciate your patience and understanding as we work to support you. If you need any further assistance or clarification, feel free to reach out - we're here to help.
Best regards,
Kristen - L - MSFT | Microsoft Community Support Specialist.