View Single Post
 
Old 03-11-2016, 02:40 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

If you title the content control into which you input the number 'NumVal' and a Rich Text content control titled 'NumText' for the words, you could use a content control on exit macro like:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Dim StrNum As String
With CCtrl
  StrNum = Trim(.Range.Text)
  If IsNumeric(StrNum) Then
  If .Title = "NumVal" Then
    With ActiveDocument
      .Fields.Add Range:=.SelectContentControlsByTitle("NumText")(1).Range, _
        Type:=wdFieldEmpty, Text:="=" & StrNum & " \* CardText", PreserveFormatting:=False
      .SelectContentControlsByTitle("NumText")(1).Range.Fields.Unlink
    End With
  End If
  End If
End With
End Sub
no protection required.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote