Last active
September 24, 2021 13:13
-
-
Save AlexLynd/03fab1fb6dadd6d6297355f42fe2f5e2 to your computer and use it in GitHub Desktop.
VB script that inserts checkbox before selected lines in Microsoft Word
This file contains 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 checkBoxAppend() | |
Dim lineCnt As Integer | |
lineCnt = Selection.Range.Sentences.Count | |
Dim Words | |
For Words = lineCnt To 1 Step -1 ' | |
Selection.MoveStartUntil "&", wdBackward | |
Selection.MoveLeft 1 | |
Dim objCC As ContentControl | |
Set objCC = ActiveDocument.ContentControls.Add(wdContentControlCheckBox) | |
objCC.Checked = False | |
Selection.MoveDown Unit:=wdLine, Count:=1 | |
Selection.Expand wdLine | |
Next Words | |
Selection.MoveStartUntil "&", wdBackward | |
Selection.MoveLeft 1 | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment