Getting character after / to capitalize
I've been scratching my head trying to get the following to detect any '/' that appears as a second character, then to capitalize the character immediately after it, which will be at position three.
If I use this as an example and capitalize the third character if it finds a 'c' at position two, then it works okay.
Code:
If oCtrl.Name = "txtVictim" Then
strTC = strConv(oCtrl.Text, vbProperCase)
Set oCC = ActiveDocument.SelectContentControlsByTag("Victim").Item(1)
oCC.Range.Text = strTC
For lngIndex = 1 To oCC.Range.Words.Count
If oCC.Range.Words(lngIndex).Characters(2) = "c" Then
oCC.Range.Words(lngIndex).Characters(3) = UCase(oCC.Range.Words(lngIndex).Characters(3))
End If
Next
If I change from 'c' to a '/' or char (47), then I get a Runtime error '5941' - The requested member of the collection does not exist on this line.
Code:
If oCC.Range.Words(lngIndex).Characters(2) = "/" Then