Doc name and page # in header

C

Craig

I have a few hundred or so word doc's. I'd like a macro
to open each one and insert the document name and page
numbers (ie: NameOfDocument.doc page 1 of 5) into the
header. Then, save and close the file, open the next, etc.

This would take forever if done by hand. Any suggestions?

Thanks!

C
 
D

DA

Hi Craig

Check the post from the 5th "Damaged word files?."
It will show you how to open your documents sequentially.

As to your header, if you do a search through the MS VBA
help files, there's all sorts of useful examples in there
(case in point below):

With ActiveDocument.Sections(1).Headers
(wdHeaderFooterPrimary)
.PageNumbers.Add _
PageNumberAlignment:=wdAlignPageNumberCenter, _
FirstPage:=False
End With

All the best,
Dennis
 
C

Craig

Thank you.
-----Original Message-----
Hi Craig

Check the post from the 5th "Damaged word files?."
It will show you how to open your documents sequentially.

As to your header, if you do a search through the MS VBA
help files, there's all sorts of useful examples in there
(case in point below):

With ActiveDocument.Sections(1).Headers
(wdHeaderFooterPrimary)
.PageNumbers.Add _
PageNumberAlignment:=wdAlignPageNumberCenter, _
FirstPage:=False
End With

All the best,
Dennis

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top