View Single Post
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Check boxes and user names in forms

If you assign the bookmark names checkname to the checkbox and textname to
the formfield in which you want the user name to be displayed and texttime
to the formfield in which you want the time to be displayed and you run a
macro containing the following code on exit from the checkname checkbox, it
will populate the textname and texttime formfields with the name of the
user and the time at which the checkbox was checked respectively.

With ActiveDocument
If .FormFields("checkName").CheckBox.Value = True Then
.FormFields("textName").result = Application.UserName
.FormFields("textTime").result = Format(Now, "yyyy-mm-dd -
hh:MM:ss")
Else
.FormFields("textName").result = ""
.FormFields("textTime").result = ""
End If
End With

Modify the format string to get the time in the format that you want it.
Check out the Format function in the visual basic help file to see the
various options.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"TobyR" wrote in message
...

I would like to create a checklist in Word using a form. The in-built
Help gives a good description on how to create a form and add
check-boxes to it, but I would like also to have fields next to the
check boxes which auto-populate with the user name when the check box
is set, and another field which auto-fills the time the check box was
ticked. Any advice or suggestions gratefully received.




--
TobyR