![]() |
#4
|
||||
|
||||
![]()
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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Legal Learning Center | Word VBA | 6 | 02-22-2020 02:24 PM |
Wrap text code not working | Bluebell | Word VBA | 5 | 03-25-2018 04:26 AM |
![]() |
welcometocandyland | Word VBA | 4 | 02-08-2017 06:53 PM |
![]() |
mpdsal | Word VBA | 8 | 09-11-2014 03:55 PM |
Code Request - Text to Columns | OTPM | Excel Programming | 0 | 02-13-2013 04:44 AM |