Check boxes and user names in forms

T

TobyR

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

Doug Robbins - Word MVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top