Forms

  • Thread starter Thread starter James
  • Start date Start date
J

James

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
 
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
 
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).Name
End If
ActiveDocument.FormFields(pFldName).Result = myString & " " _
& Format(Date, "mm/dd/yy") & ": "
Selection.Move Unit:=wdCharacter, Count:=15
End Sub
 
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
 
Back
Top