View Single Post
 
Old 12-05-2021, 02:38 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

TextBox has a specific meaning which doesn't appear to be what you are looking for in this instance.

Try this:
Set up your document with two Plain Text Content Controls. Set the title of one to "Input Number", set the other title to "Status"
Add this macro to your ThisDocument module
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
  Dim aCC As ContentControl, sMsg As String
  If ContentControl.Title = "Input Number" Then
    If IsNumeric(ContentControl.Range.Text) Then
      If CLng(Trim(ContentControl.Range.Text)) > 100 Then
        sMsg = "In Spec"
      Else
        sMsg = "Out of Spec"
      End If
    Else
      sMsg = "Needs a number greater than 100"
    End If
    For Each aCC In ActiveDocument.SelectContentControlsByTitle("Status")
      aCC.Range.Text = sMsg
    Next aCC
  End If
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote