Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Use Check Box field value in a form
We can use the fields' bookmarks to get the value, like the text boxes
"Text1" and "Text2" (I can put { ref Text1} or simply {Text1} to get the Bookmark value). But how do I use this for a check box field's bookmark? If I have "Check1" as a Check box field bookmark and I put {Check1} or {ref Check1} I don't get the value of the check box field. I'd want to get the value (I don't know if is True/False or 1/0 or -1/0...) and put it in a {IF...} field. OBS: without using VBA directly, because is easy with this mode. |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Use Check Box field value in a form
I don't think you can do this without vba - however it is simple enough. Run
the following macro on exit from the Check1 field Sub Checked() If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then For Each aVar In ActiveDocument.Variables If aVar.Name = "sCheck1" Then num = aVar.Index Next aVar If num = 0 Then ActiveDocument.Variables.Add Name:="sCheck1", Value:=1 Else ActiveDocument.Variables(num).Value = 1 End If End If If ActiveDocument.FormFields("Check1").CheckBox.Value = False Then For Each aVar In ActiveDocument.Variables If aVar.Name = "sCheck1" Then num = aVar.Index Next aVar If num = 0 Then ActiveDocument.Variables.Add Name:="sCheck1", Value:=0 Else ActiveDocument.Variables(num).Value = 0 End If End If End Sub This creates a docvariable called sCheck1 which will have the value 1 for true or 0 for false (or any other values you assign) You can use that variable in a conditional field eg { IF{ DOCVARIABLE sCheck1 } = 1 "True" "False"} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Anderflash wrote: We can use the fields' bookmarks to get the value, like the text boxes "Text1" and "Text2" (I can put { ref Text1} or simply {Text1} to get the Bookmark value). But how do I use this for a check box field's bookmark? If I have "Check1" as a Check box field bookmark and I put {Check1} or {ref Check1} I don't get the value of the check box field. I'd want to get the value (I don't know if is True/False or 1/0 or -1/0...) and put it in a {IF...} field. OBS: without using VBA directly, because is easy with this mode. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
check box form field disappears | Microsoft Word Help | |||
when i put a field (check box) into my form it didn't work - why? | Microsoft Word Help | |||
text form field and spaces | Microsoft Word Help | |||
Can I spell check a form field | Microsoft Word Help | |||
check box form field, how do I "check" using Enter Key | Microsoft Word Help |