Thanks for the kind comments about my web site. Greg has been a friend for many years and his site is recommended viewing. In particular take a look at his basic VBA primer.
I still wouldn't do the tempate this way, but your macros can certainly be improved, by avoiding all that shuffling around the document moviing Selections which is very inefficient, and by looping through the form fields. I have added a macro to deal with the content controls also e.g.
Option Explicit
Sub Complete()
Call ToggleOFF
Call CleanUp
Call PleaseClean
'Call FixCC
lbl_Exit:
Exit Sub
End Sub
Sub CleanUp()
Dim oFF As FormField
Dim orng As Range
For Each oFF In ActiveDocument.FormFields
Select Case oFF.Type
Case Is = wdFieldFormCheckBox
If oFF.CheckBox.Value = True Then
oFF.Range.Text = "True"
Else
oFF.Range.Text = "False"
End If
Case Is = wdFieldFormDropDown
If Not oFF.DropDown.Value = 0 Then
oFF.Range.Text = oFF.Result
Else
oFF.Range.Text = ""
End If
Case Else
oFF.Range.Text = oFF.Result
End Select
Next oFF
lbl_Exit:
Set oFF = Nothing
Exit Sub
err_Handler:
MsgBox Err.Number & vbCr & Err.Description
Err.Clear
GoTo lbl_Exit
End Sub
Sub ToggleOFF()
Const strPassword As String = "a"
'Unprotect the file
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=strPassword
End If
lbl_Exit:
Exit Sub
End Sub
Sub PleaseClean()
Dim orng As Range
Set orng = ActiveDocument.Range
With orng.Find
Do While .Execute(FindText:="Oculus Info:")
orng.End = orng.Paragraphs(1).Range.End - 1
orng.MoveStartUntil Chr(58) ':
orng.Start = orng.Start + 1
orng.Delete
Exit Do
Loop
End With
lbl_Exit:
Exit Sub
End Sub
Sub FixCC()
Dim oCC As ContentControl
Dim orng As Range
Dim strCC As String
For Each oCC In ActiveDocument.ContentControls
If Not oCC.Range.Text = oCC.PlaceholderText Then
strCC = oCC.Range.Text
Else
strCC = ""
End If
Set orng = oCC.Range
oCC.Delete
orng.Text = strCC
Next oCC
lbl_Exit:
Set oCC = Nothing
Exit Sub
End Sub