If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Input mask for form fields in Word
Hi,
I was asked to create a new form that has a number of date fields. The boss wants to be able to type 050209 and have it appear as 5/2/09. I know that input masks are available in MS Access, but how do I put something like this in a form field in MS Word? If anybody has any suggestions, I'd really appreciate it. Thanks, Lee |
#2
|
|||
|
|||
Input mask for form fields in Word
Lee,
You now need to get your boss to change his or her mind. 050209 is not a valid date format. Word sees this as a long value and would return a seemingly odd result. You could show this to your boss: Sub Test() Dim oDate as Date oDate = "050209" Msgbox Format(oDate, "m/d/yy") End Sub AFIAIK (and it would be clunky), all you could do is use a text field to enter the value 050209, then convert it to a valid date format, then format that valid date as the boss desires, then replace the text entered with the formatted date. Lee S. wrote: Hi, I was asked to create a new form that has a number of date fields. The boss wants to be able to type 050209 and have it appear as 5/2/09. I know that input masks are available in MS Access, but how do I put something like this in a form field in MS Word? If anybody has any suggestions, I'd really appreciate it. Thanks, Lee -- Greg Maxey - Word MVP My web site http://gregmaxey.mvps.org Word MVP web site http://word.mvps.org |
#3
|
|||
|
|||
Input mask for form fields in Word
Hi lee,
I believe I've already answered this for you at: http://www.tek-tips.com/viewthread.c...1541593&page=1 If you're going to post the same query in multiple forums, you should say so. - and acknowledge whatever advice you've already received. -- Cheers macropod [MVP - Microsoft Word] PS: A simpler form of the Function I posted at tek-Tips is: Function StrToDate(FFname As String) As String Dim TmpStr TmpStr = ActiveDocument.FormFields(FFname).Result StrToDate = TmpStr If Len(TmpStr) = 6 Then If CDate(Left(TmpStr, 2) & "/" & Mid(TmpStr, 3, 2) & "/" & Right(TmpStr, 2)) Then _ StrToDate = Format(CDate(Left(TmpStr, 2) & "/" & Mid(TmpStr, 3, 2) & "/" & Right(TmpStr, 2)), "DD-MM-YYYY") End If End Function "Lee S." wrote in message ... Hi, I was asked to create a new form that has a number of date fields. The boss wants to be able to type 050209 and have it appear as 5/2/09. I know that input masks are available in MS Access, but how do I put something like this in a form field in MS Word? If anybody has any suggestions, I'd really appreciate it. Thanks, Lee -- Lee S. |
Thread Tools | |
Display Modes | |
|
|