I found a macro on word.tips.net for doing a mass formatting on all files in a folder of your choice.
It was worked great for about 3 times, now getting an error showing: "Run-time error '5174':
This file could not be found.
Then when Debug, it highlights
Application.Documents.Open FileName:=JName
Code:
Sub MassFormatFiles()
'
' MassFormatFiles Macro
' Page Setup dialog box. Thus, things like paper size, margins, header and footer locations, and orientation
'
Dim JName As String
Dialogs(wdDialogFileOpen).Show
Application.ScreenUpdating = False
JName = Dir("*.doc")
While (JName > "")
Application.Documents.Open FileName:=JName
'Do formatting here
With Selection.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = InchesToPoints(0.5)
.BottomMargin = InchesToPoints(0.5)
.LeftMargin = InchesToPoints(0.5)
.RightMargin = InchesToPoints(0.5)
.Gutter = InchesToPoints(0)
.HeaderDistance = InchesToPoints(0.5)
.FooterDistance = InchesToPoints(0.5)
.PageWidth = InchesToPoints(8.5)
.PageHeight = InchesToPoints(11)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
End With
Selection.WholeStory
Selection.Font.Name = "Times New Roman"
Selection.Font.Size = 12
Selection.HomeKey Unit:=wdStory
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Style = ActiveDocument.Styles("Heading 1")
Selection.Font.Name = "Times New Roman"
Selection.Font.Size = 22
Selection.Font.Color = 192
ActiveDocument.Close SaveChanges:=wdSaveChanges
JName = Dir()
Wend
Application.ScreenUpdating = True
End Sub
I have tried this several times, still failing. Any suggestions would be greater appreciated.