You can use field codes in Word to automatically add a variety of document properties, such as document title (or running header), author, date, and file name, to headers and footers.
Note: If you already added a header or footer from the gallery, this procedure may replace or change the formatting of the current header or footer.
On the Insert tab, in the Header & Footer group, click Header or click Footer.
Click Edit Header or Edit Footer.
The cursor is now located in the header or the footer of your document.
On the Header & Footer Tools tab, click Quick Parts, and then click Field.
In the Field names list, choose the field you want (such as FileName, Date, Author, or Title), choose the format you want in the Field properties section, and then choose any other options you like in the Field options section.
If you have the desktop version of Word, you can click open your document in Word and insert the file name in a footer there.
Click Open in Word to open your document in the desktop version of Word.
After opening your document in Word, insert the file name in the footer. Then, press Ctrl+S to save your document to its original location.