Please help to add file name path and double line spacing to mutliple folders & sub folders

  • Thread starter Thread starter helpserv
  • Start date Start date
H

helpserv

I have hundreds of Word 2002 Documents and need to immediately add to
every document within multiple folders & their sub folders the
document's file name path within a Footer and Print with double line
spacing within the body (for ease of editing). Please help. (A very
few documents within these already have a footer...if it is possible
to exclude those from being altered, all the better, if they cant be
excluded its ok.

I am an above average computer user, but have never used a Macro or VB
script, but if that is the solution, I will also appreciate
understanding how to quickly and immediately implement the solution
presented. Thank you.
 
G'day (e-mail address removed) (helpserv),

http://word.mvps.org/FAQs/index.htm

Start with the VBA tutorials on the VBA / Macros tab. They should take
20 mins. Then, suss out the batch document skeleton and adapt it to
your needs.

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


helpserv reckoned:
 
I appreciate your suggestion. I have spent several hours trying to
make sense of where you suggested I look. Not much of it makes sense
and it is very complicated. There must be someone else who previously
needed to do something similiar as we need to do.

We are volunteers with a new non profit youth program. We have many,
many things that need to get done. We really need help being able to
edit the documents. please help....
 
The following macro will open each Word document in a selected folder, apply
double spacing to the text, add the filename and path to the end then save
print and close the document. It also creates a backup of the unaltered
version in the same folder, which is particularly desirable as you haven't
given us a clue what these document contain. You'll have to process each
file separately.

Public Sub BatchChange()
Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document

' Get the folder containing the files
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
PathToUse = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With

'Close any documents that may be open
If Documents.Count > 0 Then
Documents.Close Savechanges:=wdPromptToSaveChanges
End If

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

myFile = Dir$(PathToUse & "*.doc")

While myFile <> ""
Set myDoc = Documents.Open(PathToUse & myFile)

'Select the whole document
Selection.WholeStory
'Format as double spaced
Selection.ParagraphFormat.LineSpacingRule = wdLineSpaceDouble
'Move the cursor to the end
Selection.EndKey Unit:=wdStory
'Add a new line
Selection.TypeParagraph
'Insert the filename and path autotext entry
NormalTemplate.AutoTextEntries("Filename and path").Insert Where:= _
Selection.Range, RichText:=True

'Set option to create a backup of the unaltered version!
Options.CreateBackup = True

'print save and close the document
myDoc.PrintOut
myDoc.Close Savechanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub


See http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

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