View Single Post
 
Old 03-01-2020, 02:41 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Updated. Try it now.
Quote:
Is the added sub so I only need to change the tutor info in one properties box for them all to change?
That is quite possible, but I was loath to assume every reference to a tutor should be changed. The current approach requires each subject & session run by that tutor to at least be considered, which is a safeguard against both: (a) updating all instances when only a few need updating; and (b) overlooking some if they were to be done manually (which is still possible). For code to update all instances, you might use:
Code:
Sub BulkUpdateTutor()
Dim i As Long, j As Long, OldTutor As String, NewTutor As String
OldTutor = Trim(InputBox("Old Tutor"))
NewTutor = Trim(InputBox("New Tutor", , OldTutor))
If OldTutor = "" Then Exit Sub
With ActiveDocument
  For i = 1 To .SelectContentControlsByTitle("Subject").Count
    With .SelectContentControlsByTag("Subject_" & i)(1)
      For j = 1 To .DropdownListEntries.Count
        With .DropdownListEntries(j)
          If Trim(.Value) = OldTutor Then
            .Value = Replace(.Value, OldTutor, NewTutor)
          End If
        End With
      Next
    End With
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote