This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub CreateTOCforCDL() | |
'Add page breaks to make all chapter titles start on an odd page number | |
Dim rng As Range | |
Dim pgNum As Integer | |
Set rng = ActiveDocument.Range | |
With rng.Find | |
.style = ActiveDocument.Styles("Heading 1") | |
.Forward = True | |
.Wrap = wdFindStop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub FormatArabicStyles() | |
Dim objUndo As UndoRecord | |
Set objUndo = Application.UndoRecord | |
objUndo.StartCustomRecord ("Format Arabic text styles") | |
Application.ScreenUpdating = False | |
'-----First clear formatting, then set styles-----' | |
'CLEAR FORMATTING |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'https://answers.microsoft.com/en-us/msoffice/forum/all/removing-text-box-from-word-document-without/a4d02b2f-d168-48dc-960b-4a45cbe79d86 | |
Sub EraseTextBoxes() | |
Dim RngDoc As Range, RngShp As Range, i As Long | |
With ActiveDocument | |
For i = .Shapes.Count To 1 Step -1 | |
With .Shapes(i) | |
'If .Type = msoTextBox Then | |
'https://eileenslounge.com/viewtopic.php?p=28255#p28255 | |
If .TextFrame.HasText = True Then | |
Set RngShp = .TextFrame.TextRange |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import re | |
with open(sys.argv[1], "r", encoding="utf-8") as input: | |
with open(sys.argv[2], "x", encoding="utf-8") as output: | |
for line in input: | |
clean = (line) | |
clean = re.sub('## \*\*(Lesson [0-9]+)\*\*(\n)', '# \\1\\2', clean) # Convert Lesson #s to H1s | |
clean = re.sub('\*\*\[(.*?)\]\{\.underline\}\*\*(\n)', '### \\1\\2', clean) # Convert underlined Word H1s to md H3s | |
clean = re.sub('\*\*\*(.*?)\*\*\*(\n)', '##### \\1\\2', clean) # Convert bold and italic headers to H5s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'https://www.msofficeforums.com/word-vba/49481-remove-shading-specific-color-document-multiple-shading.html | |
Sub Macro5() | |
Dim iCol As Long | |
iCol = Selection.Shading.BackgroundPatternColor | |
With ActiveDocument.Range.Find | |
.ClearFormatting | |
.Replacement.ClearFormatting | |
.Text = "" | |
.ParagraphFormat.Shading.BackgroundPatternColor = iCol | |
.Replacement.Font.Underline = wdUnderlineSingle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'https://web.archive.org/web/20150420112826/http://help.lockergnome.com/office/Word-2007-Search-multiple-words-document--ftopict1010011.html | |
Sub HiLightList() | |
Application.ScreenUpdating = False | |
Dim vFindText | |
Dim r As Range | |
Dim i As Long | |
vFindText = Array("[!-:(0-9][0-9]{1,}[!-:,.)][!A-Z]", " ten[!a-z]", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety", "hundred[!s]", "thousand[!s]", ",000,000") | |
'Add undo function - https://docs.microsoft.com/en-us/office/vba/word/Concepts/Working-with-Word/working-with-the-undorecord-object | |
Dim objUndo As UndoRecord |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Source: https://answers.microsoft.com/en-us/msoffice/forum/all/word-2013-is-there-a-way-to-replace-tracked/adc5f04e-34d5-4423-b0ac-84d5548246be | |
Sub ConvertTrackedChangesToFormatting() | |
'Add undo function - https://docs.microsoft.com/en-us/office/vba/word/Concepts/Working-with-Word/working-with-the-undorecord-object | |
Dim objUndo As UndoRecord | |
Set objUndo = Application.UndoRecord | |
'Begin the custom undo record and provide a name for the record | |
objUndo.StartCustomRecord ("Convert Tracked Ch. to Formatting") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'https://www.mrexcel.com/board/threads/open-webpage-via-vba.832507/ | |
Sub OpenWebpage() | |
'Catch the selected reference | |
Set myRef = Selection.Range | |
Dim URLa As String | |
Dim URLb As String | |
URLa = "https://www.biblegateway.com/passage/?search=" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'https://stackoverflow.com/a/29811973 | |
Sub ConvertParentheses2FootnoteV3() | |
'Add undo function! 'https://docs.microsoft.com/en-us/office/vba/word/Concepts/Working-with-Word/working-with-the-undorecord-object | |
Dim objUndo As UndoRecord | |
Set objUndo = Application.UndoRecord | |
'Begin the custom undo record and provide a name for the record | |
objUndo.StartCustomRecord ("Replace parenth. with footnote") |