Word / form locked

C

Cimento Cola

I have a form in word, and it is locked (so that the user only changes the
box´s that i want;
How can i, by pressing a designated key, put a X in a checkbox?
Thanks for the help,
 
J

Jay Freedman

Cimento Cola said:
I have a form in word, and it is locked (so that the user only changes the
box´s that i want;
How can i, by pressing a designated key, put a X in a checkbox?
Thanks for the help,

When you tab to the checkbox, press the spacebar once to check the
box, again to uncheck it, etc. There's no provision for enabling any
other key.
 
C

Cindy M -WordMVP-

Hi Jay,
When you tab to the checkbox, press the spacebar once to check the
box, again to uncheck it, etc. There's no provision for enabling any
other key.
I would think you could assign a macro to ANY key that would change
the .Value of the currently form field (checking, of course, that
you're actually in a checkbox field).

If activeDocument.Range.FormFields(_
Selection.Bookmarks(1).Name).CheckBox.Valid Then
activeDocument.Range.FormFields( _
Selection.Bookmarks(1).Name).CheckBox.Value _
= NOT activeDocument.Range.FormFields( _
Selection.Bookmarks(1).Name).CheckBox.Value

End If

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
J

Jay Freedman

Hi, Cindy,

Yes, you're right. This works, too:

Dim ff As FormField
If (Selection.FormFields.Count > 0) Then
If Selection.FormFields(1).Type = wdFieldFormCheckBox Then
Set ff = Selection.FormFields(1)
ff.CheckBox.Value = Not ff.CheckBox.Value
End If
End If

[To "Cimento Cola", if you're still following this: Use the
instructions at http://www.gmayor.dsl.pipex.com/installing_macro.htm
to make a macro in your template from either piece of code. Then use
the instructions at
http://www.mvps.org/word/FAQs/Customization/AsgnCmdOrMacroToHotkey.htm
to assign the macro to a keystroke of your choice.]
 
C

Cindy M -WordMVP-

Hi Jay,
Selection.FormFields(1)
Are you certain? I don't usually have much luck with that,
if the document is protected as a form. Ah, but now that I
think about it, the problem doesn't apply to checkboxes,
since the focus can't be IN the checkbox (as opposed to a
textbox).

Cindy Meister
 
J

Jay Freedman

Cindy said:
Hi Jay,

Are you certain? I don't usually have much luck with that,
if the document is protected as a form. Ah, but now that I
think about it, the problem doesn't apply to checkboxes,
since the focus can't be IN the checkbox (as opposed to a
textbox).

Cindy Meister

Hi, Cindy,

Yeah, I had a peek at
http://www.mvps.org/word/FAQs/TblsFldsFms/GetCurFmFldName.htm to remind
myself of the problem, and I tried it in a document with all three types of
formfields. It does work -- not any better than your code, just a little
easier to write.
 
C

Charles Kenyon

The use of the spacebar is standard Windows interface, I think.

Clicking on the checkbox with the mouse will also check/uncheck the box.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://addbalance.com/usersguide/index.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

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