Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 07-18-2014, 02:06 AM
Jo 4x4 Jo 4x4 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jul 2014
Location: South Africa
Posts: 4
Jo 4x4 is on a distinguished road
Default Inputting a number into word in a specific format


Hi everybody. This is probably a simple fix, but I don't know how to do it. I have a template for a certificate where I enter the person's name and Identity number. This Identity number has to be in a specific format IE: yyyymmdd 1234 123 with the spaces . Some of the people using this template to type the numbers in keep on getting it wrong, so I want to "force" the number into that format.

Thanks in advance

Win 7, Office 2010
Reply With Quote
  #2  
Old 07-18-2014, 05:02 AM
Charles Kenyon Charles Kenyon is offline Windows 7 64bit Office 2010 32bit
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 4,452
Charles Kenyon is just really niceCharles Kenyon is just really niceCharles Kenyon is just really niceCharles Kenyon is just really nice
Default

I would do this using three separate legacy form fields. This would require that the document be protected for filling in forms, which places severe restrictions on editing.

Those form fields could be formatted the way you want.

To do this in Word 2010, I would probably use Greg Maxey's tools.
Add Classic FormField Controls to Ribbon I especially appreciate the addition of the classic lock button to the ribbon.

Otherwise, it could be done in vba using a UserForm (custom dialog box).

Create & Employ a Userform
Attached Images
File Type: png 00 deleteme.png (15.3 KB, 12 views)
File Type: png 01 deleteme.png (15.6 KB, 12 views)
Reply With Quote
  #3  
Old 07-18-2014, 09:32 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,319
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

It could also be done with a single content control (or formfield). The content control would require an on-exit macro, but doesn't otherwise require the constraints that come with using formfields.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #4  
Old 07-18-2014, 10:03 PM
Jo 4x4 Jo 4x4 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jul 2014
Location: South Africa
Posts: 4
Jo 4x4 is on a distinguished road
Default

Hi guys, thanks, but perhaps I should have explained that I don't know nearly enough about word. Can you please explain that in English?

Thanks
Jo
Reply With Quote
  #5  
Old 07-18-2014, 11:04 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,319
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

See attached. The document uses two content controls - one to solicit the date and another to solicit the remainder of the certificate ID. The formatting of the former is controlled by the content control's formatting and a ContentControlOnExit macro validates the latter.
Attached Files
File Type: zip DataEntry.zip (32.0 KB, 2 views)
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #6  
Old 07-19-2014, 12:19 AM
Jo 4x4 Jo 4x4 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jul 2014
Location: South Africa
Posts: 4
Jo 4x4 is on a distinguished road
Default

Thanks Paul. My problem is that some of the people working with this is not very computer literate. Our Identity numbers is something like 196705221234567. The first part being date of birth. When typed, I would like it to be printed as: 19670522 1234 567, without them needing to place the spaces, and with minimal complications.

Thanks again
Jo
Reply With Quote
  #7  
Old 07-19-2014, 12:32 AM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,319
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

The use of the two content controls was done to ensure valid data entry. Although one can use the calendar control to pick a date, it's also possible to type one into it (in any valid date format) and let the control re-format it with the YYYYMMDD format as soon as it's exited. Although I haven't implemented it, the ContentControlOnExit macro could also be used to ensure the date entered into this control falls within a valid range (e.g. a date between 1.1.2000 and today).

Similarly, although the second one allows the user to input a number in any format, it will re-format the number to the #### ### format when that content control is exited.

The second control's reformatting, and the space between the two content controls delivers the spacing you say you need. All it takes to exit either content control is to press the Tab key or to click anywhere else in the document.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #8  
Old 07-19-2014, 12:45 AM
Jo 4x4 Jo 4x4 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jul 2014
Location: South Africa
Posts: 4
Jo 4x4 is on a distinguished road
Default

Thanks Paul!!!
Reply With Quote
Reply
Please reply to this thread with any new information or opinions.

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to format a TOC (level 1) using a number, but have the number hidden in the text porpoiseoil Word 1 09-13-2014 12:53 PM
Inputting 339 supplier names into individual Word documents Aron19 Mail Merge 3 04-29-2014 04:41 PM
Change from General Format to number format gbaker Excel 3 08-16-2013 01:04 PM
Applying specific format to doc jrodriguez Word 3 07-23-2012 08:38 PM
Word DOC(X) help - Export to specific format question. archerman Word 3 12-28-2010 11:46 PM


All times are GMT -7. The time now is 09:32 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft