![]() |
#1
|
|||
|
|||
![]()
I have a content control field on a Word form that my users are filling out the U.S. county. I need the field to autopopulate the word "county" after they fill it out.
Example: User type in "Orange" in the field and once they tab out, the field will now say "Orange County" Is this possible? Thanks for the help and insight. |
#2
|
|||
|
|||
![]()
Why don't you just add the word "County" after the content control?
To answer your question. Yes. Assuming the CC titled "County" add the following to the ThisDocument module of your template project: Code:
Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean) Select Case CC.Title Case "County" If Not CC.ShowingPlaceholderText Then CC.Range.Text = CC.Range.Text & " County" End Select End Sub |
#3
|
||||
|
||||
![]()
And what if they type 'Orange County'?...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
![]()
Thats the problem I have. I figured it would be easier if it would autopopulate.
|
#5
|
|||
|
|||
![]()
Then add " County" as fixed text after the CC and use:
Code:
Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean) Select Case CC.Title Case "County" If InStr(CC.Range.Text, " County") > 0 Then CC.Range.Text = Replace(CC.Range.Text, " County", "") End Select End Sub |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is there VBA to paste text into content control? | kintap | Word VBA | 2 | 07-02-2014 07:42 AM |
![]() |
BrainSlugs83 | Word Tables | 8 | 11-14-2013 03:06 AM |
![]() |
chamdan | Word VBA | 2 | 11-12-2013 09:51 PM |
![]() |
Testor | Word VBA | 4 | 07-08-2012 07:55 AM |
Templates: automatic text generation from Rich Text content control | Chickenmunga | Word | 0 | 10-01-2008 11:16 AM |