Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-09-2014, 07:01 AM
ksigcajun ksigcajun is offline Adding auto text to end of content control field Windows 7 64bit Adding auto text to end of content control field Office 2010 64bit
Advanced Beginner
Adding auto text to end of content control field
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default Adding auto text to end of content control field

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.
Reply With Quote
  #2  
Old 10-09-2014, 11:07 AM
gmaxey gmaxey is offline Adding auto text to end of content control field Windows 7 32bit Adding auto text to end of content control field Office 2010 (Version 14.0)
Word MVP 2003-2009
 
Join Date: May 2010
Location: Marble, NC
Posts: 1,205
gmaxey has a spectacular aura aboutgmaxey has a spectacular aura aboutgmaxey has a spectacular aura about
Default

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
Reply With Quote
  #3  
Old 10-09-2014, 06:00 PM
macropod's Avatar
macropod macropod is offline Adding auto text to end of content control field Windows 7 64bit Adding auto text to end of content control field Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,194
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

And what if they type 'Orange County'?...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 10-13-2014, 05:24 AM
ksigcajun ksigcajun is offline Adding auto text to end of content control field Windows 7 64bit Adding auto text to end of content control field Office 2010 64bit
Advanced Beginner
Adding auto text to end of content control field
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
And what if they type 'Orange County'?...
Thats the problem I have. I figured it would be easier if it would autopopulate.
Reply With Quote
  #5  
Old 10-13-2014, 05:37 AM
gmaxey gmaxey is offline Adding auto text to end of content control field Windows 7 32bit Adding auto text to end of content control field Office 2010 (Version 14.0)
Word MVP 2003-2009
 
Join Date: May 2010
Location: Marble, NC
Posts: 1,205
gmaxey has a spectacular aura aboutgmaxey has a spectacular aura aboutgmaxey has a spectacular aura about
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
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
Adding auto text to end of content control field Deleting a table from a content control -- preserving the content control BrainSlugs83 Word Tables 8 11-14-2013 03:06 AM
Adding auto text to end of content control field MS WORD 2007 - Content Control versus Text Form Field question chamdan Word VBA 2 11-12-2013 09:51 PM
Adding auto text to end of content control field How do you set rich text in a content control 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

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 07:00 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft