Hi rebadoo
You don't need a macro for this. All the tools you need are on the Header
and Footer toolbar.
View > Header and Footer. The Header and Footer toolbar will appear. Click
the "Switch between Header and Footer button" to get to the footer.
On that toolbar, click the Insert Page Number button. If you then see a page
number, do Shift-F9 so you can see the field codes. Then type an equals sign
(=). So it looks like { PAGE } =
On the toolbar, click the Insert Number of Pages button. And then, click
Insert AutoText and choose Filename and path.
So it now looks like { PAGE } = { NUMPAGES }{ FILENAME \p }
What you now need to do is to select the whole thing (but *not* the
paragraph marker at the end of the paragraph). Type ctrl-F9 and type IF. So
the final field is:
{ IF { PAGE } = { NUMPAGES } { FILENAME \p } }.
Select the whole thing and press F9 to update it and Shift-F9 to display the
result.
Note that if you make a mess and need to start again, you can't type the {}
braces by hand. You must use ctrl-F9 and type between the braces that Word
inserts for you. Once you've typed the field, use F9 to update it. Shift-F9
toggles between the display of field codes and display of field results.
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word