Also this Macro would run once and you would need to run it again when the filename changes. '.doc' - if you safe a '.docx' the '.' would be preserved. What it does is simply strip the last 4 characters of the 'Filename string' e.g. Selection.InsertBefore Text:=Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 4) So, either you change that setting or you need some code.Ī very simple Macro would be the following: Sub InsertCurrentFileName() To show or not to show (Shakespearean style) the extension is purely up to the Windows Explorer setting to show or hide known file extensions.
Insert > QuickParts > Field > FileName is the way to go, but as you see from the screenshot below, you do not have the option to turn the file extension on or off.