Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
AmandaH AmandaH is offline
external usenet poster
 
Posts: 54
Default Problem with Formatting Phone Numbers in Word 2003

Ok so here the problem, I know how to set the form field such that it
will produce a phone number in the form (###) ###-#### when the user
enters 10 digits. However what is wanted is that the user will be about
to enter any comin type of phone number and and it will reformatted as
(###) ###-####

Example:

(555) 555-5555 - stays the same
555-555-5555 - becomes (555) 555-5555
555 555-5555 - becomes (555) 555-5555
5555555555 - Becomes (555) 555-5555

The only one I seem to be able to get working is the last one and this
only works when I have the length of the form field set to 10.
Otherwise for all the rest I get an error msg stating that I have an
invalid number.

Is there a way to format this field so that it will take any normally
telephone number style and covert it to (555) 555-5555? A Marco
somewhere?

Thanks,

~Amanda~

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default Problem with Formatting Phone Numbers in Word 2003

Do you have the field type set to Number? I have a form set up this way. I
am actually using all hyphens (###-###-####), and I have 000-000-0000 as the
display text. But regardless of whether the user enters 1234567890 or
123-456-7890 or (123) 456-7890 or any other variation, it works fine. I have
the length of the field set to 14 characters so that users who use
parentheses don't get an error message or get booted out prematurely. Both
"Fill-in enabled" and "Calculate on exit" are checked; the format doesn't
change until the user tabs out of the field.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"AmandaH" wrote in message
oups.com...
Ok so here the problem, I know how to set the form field such that it
will produce a phone number in the form (###) ###-#### when the user
enters 10 digits. However what is wanted is that the user will be about
to enter any comin type of phone number and and it will reformatted as
(###) ###-####

Example:

(555) 555-5555 - stays the same
555-555-5555 - becomes (555) 555-5555
555 555-5555 - becomes (555) 555-5555
5555555555 - Becomes (555) 555-5555

The only one I seem to be able to get working is the last one and this
only works when I have the length of the form field set to 10.
Otherwise for all the rest I get an error msg stating that I have an
invalid number.

Is there a way to format this field so that it will take any normally
telephone number style and covert it to (555) 555-5555? A Marco
somewhere?

Thanks,

~Amanda~


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
AmandaH AmandaH is offline
external usenet poster
 
Posts: 54
Default Problem with Formatting Phone Numbers in Word 2003

Thanks, it seems to be working now with the TAB, Mouse and the down/up
arrow keys. However I have it set up that the enter key is assigned to
work as the TAB key and I get the invalid number when I try to use the
enter key to go to the next field. Any ideas?

Here is the code:


Sub EnterKeyMacro()
' Check whether the document is protected for forms
' and whether the protection is active.

If ActiveDocument.ProtectionType = wdAllowOnlyFormFields And _
Selection.Sections(1).ProtectedForForms = True Then
' Retrieve the bookmark of the current selection.
' This is equivalent to the name of the form field.
myformfield = Selection.Bookmarks(1).Name
'sets the enter key equal to the action of the TAB key
SendKeys (" {TAB}")
Else
' If the document is not protected for forms,
' insert a tab stop character.
Selection.TypeText Chr(13)
End If
End Sub

Sub AutoOpen()
' This macro will reassign the ENTER key when you open an existing
' Word form fields document.
CustomizationContext = ActiveDocument.AttachedTemplate
' Bind the Enter key to the EnterKeyMacro.
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
KeyCategory:=wdKeyCategoryMacro, Command:="EnterKeyMacro"

'Changes the open Document view to PrintView
ActiveWindow.View.Type = wdPrintView
End Sub

Sub AutoClose()
'Release the enter key back to normal
CustomizationContext = ActiveDocument.AttachedTemplate
FindKey(KeyCode:=BuildKeyCode(wdKeyReturn)).Disabl e
End Sub

Thanks
~Amanda~

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word should catalog misspelled words to study. rndthought Microsoft Word Help 39 May 21st 23 02:47 AM
Converting WordPerfect 12 files to Word 2003 Curious New Users 4 May 19th 23 02:48 PM
How to put graphics on envelopes? Steve Koenig Microsoft Word Help 21 April 29th 23 02:47 AM
Word applies direct format on File open Uriel Microsoft Word Help 16 November 27th 05 07:22 PM
Word 2003 Mailmerge problem - works in Word 2000 Rick Robinson Mailmerge 2 April 28th 05 10:16 AM


All times are GMT +1. The time now is 12:52 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"