#1   Report Post  
Posted to microsoft.public.word.docmanagement
Iragalam Iragalam is offline
external usenet poster
 
Posts: 34
Default conditional checkbox??

I am trying to use some checkboxes in a conditional if statement. I don't
know what to put in place for Expression2. I want it to be the value when
the box is checked, but don't know what that is.

Any ideas?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Bear[_2_] Bear[_2_] is offline
external usenet poster
 
Posts: 314
Default conditional checkbox??

I don't know of any way to evaluate the state of a formfield check box in Word.

This macro will add a document variable for each check box in the document.
The variable will be named the same as the check box. If you set this as the
exit macro for the check boxes, or include this code in the exit macro for
the check boxes, it will update the value of the variables.

Dim objFormField As FormField

On Error Resume Next
For Each objFormField In ActiveDocument.FormFields
If objFormField.Type = wdFieldFormCheckBox Then
ActiveDocument.Variables.Add Name:=objFormField.Name
ActiveDocument.Variables(objFormField.Name).Value =
objFormField.Result
End If
Next objFormField

That means you'll be able to use something like { DOCVARIABLE "Check1" } for
Expression2.

Note that you'll have to exit from a check box before the values will be
updated correctly, but once you do that, your IF field will work.


Bear

--
Windows XP, Word 2000

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Iragalam Iragalam is offline
external usenet poster
 
Posts: 34
Default conditional checkbox??

Thanks, I would have thought there would have been an easier way.
I'm going to go with a few dropdown boxes this time.

"Bear" wrote:

I don't know of any way to evaluate the state of a formfield check box in Word.

This macro will add a document variable for each check box in the document.
The variable will be named the same as the check box. If you set this as the
exit macro for the check boxes, or include this code in the exit macro for
the check boxes, it will update the value of the variables.

Dim objFormField As FormField

On Error Resume Next
For Each objFormField In ActiveDocument.FormFields
If objFormField.Type = wdFieldFormCheckBox Then
ActiveDocument.Variables.Add Name:=objFormField.Name
ActiveDocument.Variables(objFormField.Name).Value =
objFormField.Result
End If
Next objFormField

That means you'll be able to use something like { DOCVARIABLE "Check1" } for
Expression2.

Note that you'll have to exit from a check box before the values will be
updated correctly, but once you do that, your IF field will work.


Bear

--
Windows XP, Word 2000

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
check in a checkbox aoxee Microsoft Word Help 1 April 19th 07 08:43 PM
Checkbox Danny Microsoft Word Help 9 May 1st 06 06:16 PM
Conditional Slash Similar to Conditional Hyphen? Oliver St Quintin Page Layout 7 May 10th 05 09:41 PM
IF THEN ELSE with FORM CHECKBOX Jane Mailmerge 1 March 25th 05 07:55 AM
Displaying Checkbox JerryK Mailmerge 1 February 15th 05 11:17 PM


All times are GMT +1. The time now is 08:15 AM.

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"