Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
Tazzy via OfficeKB.com Tazzy via OfficeKB.com is offline
external usenet poster
 
Posts: 6
Default Multiple Replacements

Hi all,

I wonder if anyone can help me with this one. I have about 150+ Word
documents that need to have the footers amended so that all documents present
a corporate image. Is there any way of doing this without having to open
each document and go through them manually?

Hope someone knows the answer!

Tazzy

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/200701/1

  #2   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Multiple Replacements

Certainly all the documents will have to be opened to do this - but you may
be able to do what you want using a batch process macro. This would rely on
all the footers being the same and you would need to know whether some or
all the documents had multiple sections perhaps with different footers or
had password protection (such as forms).

The basic code structure is as follows. The macro opens each document in a
selected folder, opens the footer of that document and replaces whatever is
there with an autotext field - here calling the autotext "Logo". Create
your revised footer and save it all as an autotext entry called "Logo" and
run the macro. This will only work with simple documents so do test it on a
small sample of *Copies*!!!

If your documents are more complex you will have to add extra code to deal
with whatever the macro may find on opening them.

In the future documents may be modified simply by recreating the autotext
entry.

Sub AddFooterToDocs()
On Error GoTo err_FolderContents
Dim FirstLoop As Boolean
Dim DocList As String
Dim DocDir As String

With Dialogs(wdDialogCopyFile)
If .Display 0 Then
DocDir = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

Application.ScreenUpdating = False

FirstLoop = True

If Left(DocDir, 1) = Chr(34) Then
DocDir = Mid(DocDir, 2, Len(DocDir) - 2)
End If

DocList = Dir$(DocDir & "*.doc")
Do While DocList ""
Documents.Open DocList
'Insert an autotext entry in the footer
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.WholeStory
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
"AUTOTEXT Logo ", PreserveFormatting:=True
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ActiveDocument.Close SaveChanges:=wdSaveChanges
DocList = Dir$()
FirstLoop = False
Loop
Application.ScreenUpdating = True
Exit Sub
err_FolderContents:
MsgBox Err.Description
Exit Sub
End Sub




Tazzy via OfficeKB.com wrote:
Hi all,

I wonder if anyone can help me with this one. I have about 150+ Word
documents that need to have the footers amended so that all documents
present a corporate image. Is there any way of doing this without
having to open each document and go through them manually?

Hope someone knows the answer!

Tazzy



  #3   Report Post  
Posted to microsoft.public.word.newusers
Tazzy via OfficeKB.com Tazzy via OfficeKB.com is offline
external usenet poster
 
Posts: 6
Default Multiple Replacements

Thanks for that Graham, I will be trying that out later during the day

Graham Mayor wrote:
Certainly all the documents will have to be opened to do this - but you may
be able to do what you want using a batch process macro. This would rely on
all the footers being the same and you would need to know whether some or
all the documents had multiple sections perhaps with different footers or
had password protection (such as forms).

The basic code structure is as follows. The macro opens each document in a
selected folder, opens the footer of that document and replaces whatever is
there with an autotext field - here calling the autotext "Logo". Create
your revised footer and save it all as an autotext entry called "Logo" and
run the macro. This will only work with simple documents so do test it on a
small sample of *Copies*!!!

If your documents are more complex you will have to add extra code to deal
with whatever the macro may find on opening them.

In the future documents may be modified simply by recreating the autotext
entry.

Sub AddFooterToDocs()
On Error GoTo err_FolderContents
Dim FirstLoop As Boolean
Dim DocList As String
Dim DocDir As String

With Dialogs(wdDialogCopyFile)
If .Display 0 Then
DocDir = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

Application.ScreenUpdating = False

FirstLoop = True

If Left(DocDir, 1) = Chr(34) Then
DocDir = Mid(DocDir, 2, Len(DocDir) - 2)
End If

DocList = Dir$(DocDir & "*.doc")
Do While DocList ""
Documents.Open DocList
'Insert an autotext entry in the footer
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.WholeStory
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
"AUTOTEXT Logo ", PreserveFormatting:=True
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ActiveDocument.Close SaveChanges:=wdSaveChanges
DocList = Dir$()
FirstLoop = False
Loop
Application.ScreenUpdating = True
Exit Sub
err_FolderContents:
MsgBox Err.Description
Exit Sub
End Sub

Hi all,

[quoted text clipped - 6 lines]

Tazzy


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/200701/1

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I print multiple copies of multiple documents PeterK Microsoft Word Help 0 March 23rd 06 09:02 AM
Printing multiple copies, multiple pages to a sheet? Heather Microsoft Word Help 1 August 26th 05 08:05 PM
text with multiple fonts inserted into document with multiple columns? [email protected] New Users 4 July 22nd 05 01:45 AM
How do I open multiple Word 2003 files to display on dual monitors mally Microsoft Word Help 6 July 4th 05 11:00 AM
Multiple docs open multiple words Ron Smith New Users 2 December 11th 04 09:21 PM


All times are GMT +1. The time now is 07:13 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"