#1
|
|||
|
|||
Adding identical footers to 187 separate docs
I have 187 word documents that I need to add the same footer to. Is there any way to do this without having to do them individually? |
#2
|
||||
|
||||
Hi sqzdog,
Do any of the documents already have anything in the footers that needs to be preserved and, if so, is your std footer content to be inserted before, or after, the existing content?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
There is nothing in the footer on these documents.
|
#4
|
||||
|
||||
Hi sqzdog,
Try something along the lines of: Code:
Sub UpdateDocuments() Application.ScreenUpdating = False Dim strFolder As String, strFile As String, wdDoc As Document strFolder = GetFolder If strFolder = "" Then Exit Sub strFile = Dir(strFolder & "\*.doc", vbNormal) While strFile <> "" Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False) With wdDoc.Sections(1).Footers(wdHeaderFooterPrimary).Range .Text = "My Footer Text" With .Font .Size = 15 .Name = "Arial" .Bold = True End With End With wdDoc.Close SaveChanges:=True strFile = Dir() Wend Set wdDoc = Nothing Application.ScreenUpdating = True End Sub Function GetFolder() As String Dim oFolder As Object GetFolder = "" Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0) If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path Set oFolder = Nothing End Function
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Thank you for the reply, but I have no idea what to do with that code! Can you assist?
|
#6
|
||||
|
||||
Hi sqzdog,
What you would do is install the macro in to, say, a new document, then run the 'UpdateDocuments' sub. This will display a prompt for you to navigate to the folder where the documents are and then it will automatically insert some text into the footer of every document in that folder. As coded, the macro I posted will put the words "My Footer Text" into the main footer of every document in a chosen folder, in 15pt Arial bold. You can change any of these attributes, or use different ones (eg italic, red text, etc). If you don't know how to install/use a macro see: http://www.gmayor.com/installing_macro.htm
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
You have NO IDEA how much time and effort you saved me. Thank you!!
This worked like a charm. Is there a way to center the text in the footer, if not, no big deal. Just happy to have it finished!! |
#8
|
||||
|
||||
Hi sqzdog,
You could add a centring function after the line: With wdDoc.Sections(1).Footers(wdHeaderFooterPrimary).R ange Simply insert: .Paragraphs.First.Alignment = wdAlignParagraphCenter
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
Thanks for your help
|
#10
|
|||
|
|||
Now, I need to do the same thing for the header. Using the code in the previous post, what do I change to make changes to the headers in the 187 files?
|
#11
|
|||
|
|||
Paging Macropod.... can you help me? See above.
|
#12
|
||||
|
||||
Hi sqzdog,
I'm travelling with only intermitent internet access, hence the delay in replying. What you're asking is a rather trivial task (and should have been fairly obvious) - change: With wdDoc.Sections(1).Footers(wdHeaderFooterPrimary).R ange to: With wdDoc.Sections(1).Headers(wdHeaderFooterPrimary).R ange or, if you want to combine both routines into the same code, simply duplicate the: With wdDoc.Sections(1).Footers(wdHeaderFooterPrimary).R ange ... End With block and make the above change to one of them.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Any easy way to separate a Word document into separate files? | SamHelm | Word | 0 | 08-21-2010 05:29 AM |
Cannot open two separate MS word window | bunny_biceps | Word | 2 | 08-17-2010 01:51 PM |
Headers and Footers | OverAchiever13 | Word | 1 | 05-27-2010 01:30 PM |
CHALLENGE! Issue sorting data containing relative references on a separate tab | lax828 | Excel | 3 | 01-07-2010 11:28 AM |
Can I separate a word Doc (docx) from the template used to create it (dotx)? | paulnevlud | Word | 2 | 12-14-2009 10:13 AM |