Automating Checkbox Fields in Word

P

professor1554

Using a macro, I would like to to do the following:
If TableBookMark!K10 < 0 Then
CkboxField1.True or CkboxField1 = True
CkboxField2.False or CkboxField2 = False
Else
CkboxField1.False
CkboxField2.True

I have cell (K10) in a table (called Table1) that has either a positive or
negative value. I have two check boxes, one labelled 'Decreased', the other
labelled 'Increased'. Depending on whether K10 is pos or neg, I want the
appropriate Checkbox checked. Can I do this? Is a macro the answer, and if
so how do I find out the code? Is there a good online reference for MS macro
reserved names, that doesn't cost anything?
 
D

Doug Robbins - Word MVP

You can do this with a couple of If...then...Else field constructions as
follows

{ IF { REF k10 } > 0 "Increased #" "Decreased &" }
{ IF { REF k10 } > 0 "Decreased &" "Decreased #" }

In place of the # in the above field constructions, insert the Windings
symbol for a checked box (Character Code 254) from the Insert Symbol dialog
and in place of the & insert Wingdings symbol for an unchecked box
(Character Code 168)

You must use Ctrl+F9 to insert each of the field delimiters { } and you use
Alt+F9 to toggle off the displayof the field codes and F9 to update the
fields to show the appropriate information.

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

professor1554

I'm sorry. I just don't understand. I tried using the code below and got
unexpected results. I tried modifying the code, changing the {} to (), I
substituted Table1 for REF, I typed in Chr$(254) in place of #, and Chr$(168)
for &, etc. I don't understand the answer because I just do not have enough
experience. Can you make it clearer for me, or provide me with a more
intuitive approach to solving my problem? Maybe my question is not clear. I
bookmarked the two checkboxes as inchkbx and decchkbx. The table is
bookmarked as Table1. The cell reference is K10. I tried using the ctrl+F9
function, but didn't get expected results. I tried using the Insert>Field
method and tried typing in the formula. Like I said...there is something I
just don't understand, because I do not have enough experience. Thanks
 
D

Doug Robbins - Word MVP

Where the # and & appeared in my suggestion, use must insert the appropriate
Wingdings symbol from the Insert>Symbol dialog.

If K10 is the cell address, and not a bookmark, you will need to select the
table and then from the Insert menu, select Bookmark and give the table a
name (e.g Table1) and then use

{ IF { Sum(Table1 k10) } > 0 "Increased #" "Decreased &" }
{ IF { Sum(Table1 k10) } > 0 "Decreased &" "Decreased #" }

If you send me an email with you actual email address, I will send you a
document with the above field construction set up in it.


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

professor1554

(e-mail address removed). Thanks

Doug Robbins - Word MVP said:
Where the # and & appeared in my suggestion, use must insert the appropriate
Wingdings symbol from the Insert>Symbol dialog.

If K10 is the cell address, and not a bookmark, you will need to select the
table and then from the Insert menu, select Bookmark and give the table a
name (e.g Table1) and then use

{ IF { Sum(Table1 k10) } > 0 "Increased #" "Decreased &" }
{ IF { Sum(Table1 k10) } > 0 "Decreased &" "Decreased #" }

If you send me an email with you actual email address, I will send you a
document with the above field construction set up in it.


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

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