Your feeling is absolutely correct.
Insert > QuickParts > Field > FileName is the way to go, but as you can see in the screenshot below, you have no way to enable or disable the file extension.
To show or not to show (Shakespearean style) the extension simply depends on the settings of Windows Explorer to show or hide known file extensions. Thus, either you change this parameter, or you need some kind of code.
A very simple macro will be as follows:
Sub InsertCurrentFileName() Selection.InsertBefore Text:=Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 4) End Sub
What he does is simply cut the last 4 characters of the string "Filename string", for example. ".doc" - if you save ".docx", "." will be saved. Also, this macro will run once, and you will need to run it again when the file name changes.
Perhaps you could explain something else that you want to achieve by having the file name in the title of the document? Are you trying to use the file name in the document header to set some PDF property during conversion? Why not use the title of the document? You need the original PDF file name later - why?
Two more pages to help you solve your problem (both rely on macros ...):
source share