Line re-formatting for Gutenberg Etext Word Macro

From DPCanadaWiki

Jump to: navigation, search

Check for poetry or other indented material. Mark the end of each line with @.

Save the file.

Install the macro. Go Tools/Macro/VB editor, cut and paste the macro below into the editor window, and close.

Run the macro. Select Tools/Macro/Macros, select the Gutenberg macro, and click Run. It takes a while to run so be patient. (The macro below works in Word 2000; your mileage may vary.)


Sub Gutenberg()
 '
 ' Gutenberg Macro
 ' Line re-formatting for Gutenberg Etext.
 '
     Selection.Find.ClearFormatting
     Selection.Find.Replacement.ClearFormatting
     With Selection.Find
         .Text = "^p^p"
         .Replacement.Text = "@@"
         .Forward = True
         .Wrap = wdFindContinue
         .Format = False
         .MatchCase = False
         .MatchWholeWord = False
         .MatchWildcards = False
         .MatchSoundsLike = False
         .MatchAllWordForms = False
     End With
     Selection.Find.Execute Replace:=wdReplaceAll
     With Selection.Find
         .Text = "^p"
         .Replacement.Text = " "
         .Forward = True
         .Wrap = wdFindContinue
         .Format = False
         .MatchCase = False
         .MatchWholeWord = False
         .MatchWildcards = False
         .MatchSoundsLike = False
         .MatchAllWordForms = False
     End With
     Selection.Find.Execute Replace:=wdReplaceAll
     With Selection.Find
         .Text = "@"
         .Replacement.Text = "^p"
         .Forward = True
         .Wrap = wdFindContinue
         .Format = False
         .MatchCase = False
         .MatchWholeWord = False
         .MatchWildcards = False
         .MatchSoundsLike = False
         .MatchAllWordForms = False
     End With
     Selection.Find.Execute Replace:=wdReplaceAll
     With Selection.Find
         .Text = "  "
         .Replacement.Text = " "
         .Forward = True
         .Wrap = wdFindContinue
         .Format = False
         .MatchCase = False
         .MatchWholeWord = False
         .MatchWildcards = False
         .MatchSoundsLike = False
         .MatchAllWordForms = False
     End With
     Selection.Find.Execute Replace:=wdReplaceAll
     With ActiveDocument.PageSetup
         .LineNumbering.Active = False
         .Orientation = wdOrientPortrait
         .TopMargin = InchesToPoints(1)
         .BottomMargin = InchesToPoints(1)
         .LeftMargin = InchesToPoints(0.92)
         .RightMargin = InchesToPoints(2)
         .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
         .GutterPos = wdGutterPosLeft
     End With
 End Sub
Personal tools