Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Forms
Hello,
I have a form where one field asks for the persons initials. I would like any field that the user is in to automatically insert thier initials and date and then allow them to insert thier own text. Example: Field INITIAL: JWA Fieled COMMENTS: JWA 5/5/05: This is my comment. In the field COMMENTS once the user is in the field it would automatically insert their initials and the current date along with a semicolon. Thanks in advance! JA |
#2
|
|||
|
|||
James,
You will need a macro set to run on entry to each field following the Initials field. I created a simple document with two fields bookmarked Text1 and Text2. Run the macro named FieldID on entry to Text2. Sub FieldID() Dim myString As String myString = ActiveDocument.FormFields("Text1").Result ActiveDocument.FormFields("Text2").Result = myString & " " _ & Format(Date, "mm/dd/yy") & ": " Selection.Move Unit:=wdCharacter, Count:=15 End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. James" wrote: Hello, I have a form where one field asks for the persons initials. I would like any field that the user is in to automatically insert thier initials and date and then allow them to insert thier own text. Example: Field INITIAL: JWA Fieled COMMENTS: JWA 5/5/05: This is my comment. In the field COMMENTS once the user is in the field it would automatically insert their initials and the current date along with a semicolon. Thanks in advance! JA |
#3
|
|||
|
|||
James,
This makes it a little more general. You can run the FiledID macro on all textform fields after the Initials field. Sub FieldID() Dim myString As String Dim pFldName As String myString = ActiveDocument.FormFields("Text1").Result If Selection.FormFields.Count = 1 Then pFldName = Selection.FormFields(1).Name ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count 0 Then pFldName = Selection.Bookmarks(Selection.Bookmarks.Count).Nam e End If ActiveDocument.FormFields(pFldName).Result = myString & " " _ & Format(Date, "mm/dd/yy") & ": " Selection.Move Unit:=wdCharacter, Count:=15 End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. James" wrote: Hello, I have a form where one field asks for the persons initials. I would like any field that the user is in to automatically insert thier initials and date and then allow them to insert thier own text. Example: Field INITIAL: JWA Fieled COMMENTS: JWA 5/5/05: This is my comment. In the field COMMENTS once the user is in the field it would automatically insert their initials and the current date along with a semicolon. Thanks in advance! JA |
#4
|
|||
|
|||
Hello Greg,
Thanks for the help! After I submitted the new form my boss told me that she now wants a Wizard to generate a dynamic form. When will this madness end! lol I appreciate the help! Thanks again! James Greg Maxey wrote: James, This makes it a little more general. You can run the FiledID macro on all textform fields after the Initials field. Sub FieldID() Dim myString As String Dim pFldName As String myString = ActiveDocument.FormFields("Text1").Result If Selection.FormFields.Count = 1 Then pFldName = Selection.FormFields(1).Name ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count 0 Then pFldName = Selection.Bookmarks(Selection.Bookmarks.Count).Nam e End If ActiveDocument.FormFields(pFldName).Result = myString & " " _ & Format(Date, "mm/dd/yy") & ": " Selection.Move Unit:=wdCharacter, Count:=15 End Sub |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
forms | New Users | |||
Disappearing Checkboxes in Forms | Microsoft Word Help | |||
Advice on forms | Microsoft Word Help | |||
Spell check in Forms | Microsoft Word Help | |||
Forms toolbar won't stay on | Microsoft Word Help |