adjusted top margin on multiple documents

  • Thread starter Thread starter Candace
  • Start date Start date
C

Candace

We are using Word 2003. Our company changed letterhead, which means we need
to adjust the top margin on over 50 merge documents. Is there a way to adjust
the margin(s) of several documents at once? Or will I have to go into each
individual document to do so?
 
Batch processing a selection of documents is easy enough, but are these
document templates or documents? If the latter are they all based on the
same template or different ones? And if they are why are you changing them
for letters already sent? Does the new margin in question apply to all
sections or just one?

If they are simple documents with only one top margin setting the following
macro will set that to the figure in brackets where indicated.

Sub BatchChangeMargin()
Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the documents to be modifed and click
OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
PathToUse = fDialog.SelectedItems.Item(1)
If Right(PathToUse, 1) <> "\" Then PathToUse = PathToUse + "\"
End With
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
myFile = Dir$(PathToUse & "*.doc")
While myFile <> ""
Set myDoc = Documents.Open(PathToUse & myFile)
ActiveWindow.View.ShowFieldCodes = True

'Set top margin to 1.25 inches
ActiveDocument.PageSetup.TopMargin = InchesToPoints(1.25)

ActiveWindow.View.ShowFieldCodes = False
myDoc.Close SaveChanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top