I have placed all the code snippets from the book here and then some. Copy them into the a macro in the Microsoft Visual Basic editor between the Sub and End Sub lines. For detailed steps to create a macro, see Creating a Paste Unformatted macro in chapter 1.5 of the book. |
Code
Converting All Footnotes to Text (Chapter 7.2.3)
Since self-publishing programs do not take kindly to Word footnotes, you need to convert all of them to text. One way is to convert them all to endnotes, then copy them to text. Word provides functions to convert all footnotes to endnotes and vice-verse.
You can convert endnotes to text as described in chapter 7.2.3. If, instead, you want to change all footnotes to in-line text, the following code from techsupportforum.com will do the trick.AR: Click References | Footnotes dialog launcher (the tiny arrow in the bottom right corner of the Footnotes group. BR: Click Insert | Reference | Footnotes. In the Footnote and Endnote dialog box click [Convert]. Click the a radio button to convert footnotes to endnotes, endnotes to footnotes, or converting both to the other at the same time by clicking Swap footnotes and endnotes. Sub ConvertFootNotesToText() |
Paste Unformatted macro (Chapter 1.5)
Selection.PasteSpecial Link:=False, DataType:=20,
Placement:=wdInLine, DisplayAsIcon:=False |
Cut To comma macro (Chapter 1.5)
With Selection
.Extend Character:=","
Selection.Cut |
Macro to go back to the last location (Word 2007/10) (Chapter 1.6.3)
If
If you do not like the prompting to save the file on close, you can follow the practice of Graham Mayor and save the bookmark whenever the document is saved, as done in the following code. See the post in the Office Community atApplication.GoBack does not work in your version of Word, you can still return to the last location you edited when you reopen the document by using a bookmark. The AutoClose macro saves the current location as a bookmark when you close a document. The AutoOpen macro then jumps to that bookmark on open. The code was developed by Edward Mendelson and published in PC Magazine athttp://www.pcmag.com/article2/0,2817,2329214,00.asp Sub AutoClose() On Error Resume Next On Error Resume Next
End Sub http://answers.microsoft.com/en-us/office/forum/office_2007-word/how-to-make-word-2007-remember-last-positionpage/54299522-52f1-4b50-a4e1-c4689b3b8018 Sub FileSave()
On Error Resume Next
End Sub |
FARM macro for general replace (Chapter 3.2)
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Execute Replace:=wdReplaceAll |
FARM macro for whole-word replace (Chapter 3.2)
With Selection.Find .Text = "cld"
Selection.Find.Execute Replace:=wdReplaceAll |
FARM macro for replace down (Chapter 3.2)
With Selection.Find .Text = "xdc"
.Replacement.Text =
"Washington, DC"
.Forward = True
.Wrap = WdFindStop
.Format = False
.MatchWholeWord = True
.MatchByte = False
.MatchWildcards = False
.MatchSoundsLike =
False
.MatchAllWordForms =
False
End With
Selection.Find.Execute Replace:=wdReplaceAll |
1-8 of 8