Reply
 
Thread Tools Display Modes
  #1   Report Post  
TobyR TobyR is offline
Junior Member
 
Posts: 0
Default Check boxes and user names in forms

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.
  #2   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


  #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


  #4   Report Post  
TobyR TobyR is offline
Junior Member
 
Posts: 0
Default

Many thanks for the advice Doug - does this mean however (as I think it does) that I will need one macro per checkbox I want to track in this way?

Quote:
Originally Posted by Doug Robbins - Word MVP View Post
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
  #5   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

See response to your original post.

--
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
...

Moderators please delete - post worked first time round! MS Word 2007
help has a good section on how to create a form with check boxes (using
legacy controls) but I would like to do something a little more complex,
namely having fields next to the checkbox which update with the the
username of the person setting the check box and the date the check box
is set. Is this possible? Any advice or suggestion gratefully
received.




--
TobyR




  #6   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

See response to your original post.

--
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
...

Moderators please delete - post worked first time round! MS Word 2007
help has a good section on how to create a form with check boxes (using
legacy controls) but I would like to do something a little more complex,
namely having fields next to the checkbox which update with the the
username of the person setting the check box and the date the check box
is set. Is this possible? Any advice or suggestion gratefully
received.




--
TobyR


  #7   Report Post  
TobyR TobyR is offline
Junior Member
 
Posts: 0
Default

Indeed, I did post a second time when I thought my first post didn't work - sorry for the confusion. But to reiterate my last question, would I have to create a separate macro for each checkbox/text-field grouping? If so, is there some way to avoid this as I have in mind a form with about 50 check boxes.

  #8   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

How do you have all of the checkboxes and other formfields arranged?

If they each checkbox and the Name and Time text formfields associated with
it were all in a one row of a table in the order Checkbox, Name formfield,
Time formfield, then you should be able to use the following code on exit
from each of the check boxes

With Selection.Rows(1).Range
If .FormFields(1).CheckBox.Value = True Then
.FormFields(2).result = Application.UserName
.FormFields(3).result = Format(Now, "yyyy-mm-dd -
hh:MM:ss")
Else
.FormFields(2).result = ""
.FormFields(3).result = ""
End If
End With


--
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
...

Indeed, I did post a second time when I thought my first post didn't
work - sorry for the confusion. But to reiterate my last question,
would I have to create a separate macro for each checkbox/text-field
grouping? If so, is there some way to avoid this as I have in mind a
form with about 50 check boxes.

Doug Robbins - Word MVP;460299 Wrote:
See response to your original post.



"TobyR" wrote in message
...-

Moderators please delete - post worked first time round! MS Word 2007
help has a good section on how to create a form with check boxes
(using
legacy controls) but I would like to do something a little more
complex,
namely having fields next to the checkbox which update with the the
username of the person setting the check box and the date the check
box
is set. Is this possible? Any advice or suggestion gratefully
received.




--
TobyR -





--
TobyR


  #9   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

How do you have all of the checkboxes and other formfields arranged?

If they each checkbox and the Name and Time text formfields associated with
it were all in a one row of a table in the order Checkbox, Name formfield,
Time formfield, then you should be able to use the following code on exit
from each of the check boxes

With Selection.Rows(1).Range
If .FormFields(1).CheckBox.Value = True Then
.FormFields(2).result = Application.UserName
.FormFields(3).result = Format(Now, "yyyy-mm-dd -
hh:MM:ss")
Else
.FormFields(2).result = ""
.FormFields(3).result = ""
End If
End With


--
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
...

Indeed, I did post a second time when I thought my first post didn't
work - sorry for the confusion. But to reiterate my last question,
would I have to create a separate macro for each checkbox/text-field
grouping? If so, is there some way to avoid this as I have in mind a
form with about 50 check boxes.

Doug Robbins - Word MVP;460299 Wrote:
See response to your original post.



"TobyR" wrote in message
...-

Moderators please delete - post worked first time round! MS Word 2007
help has a good section on how to create a form with check boxes
(using
legacy controls) but I would like to do something a little more
complex,
namely having fields next to the checkbox which update with the the
username of the person setting the check box and the date the check
box
is set. Is this possible? Any advice or suggestion gratefully
received.




--
TobyR -





--
TobyR


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i add check boxes to my letters or forms Chef J Parks Page Layout 1 April 5th 08 03:11 AM
Spell Check in Forms Text Boxes? MSUSER Microsoft Word Help 1 November 6th 07 03:55 PM
I need help with check boxes in creating forms in Word Denise Microsoft Word Help 1 May 13th 06 03:07 PM
User Forms and Combo boxes in Work Kay Microsoft Word Help 2 December 17th 05 02:47 AM
Using check boxes within forms and email Louise Microsoft Word Help 2 October 13th 05 09:26 AM


All times are GMT +1. The time now is 08:28 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"