![]() |
#2
|
||||
|
||||
![]()
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
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
content control, vba, word 2010 |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Protecting document | brucemc777 | Word | 2 | 01-23-2016 02:38 PM |
![]() |
dwciardi | Word | 3 | 09-30-2015 01:03 PM |
![]() |
rgburridge | Word VBA | 4 | 01-27-2015 02:37 PM |
Disabling content controls and protecting document sections. | Catty | Word VBA | 2 | 11-29-2013 05:10 AM |
Protecting Word Document by restricting access permissions! | user | Word | 0 | 11-20-2008 01:21 PM |