April 9, 2024
Contribute to the Microsoft 365 and Office forum!
Click here to learn more 💡
May 10, 2024
Word Forum Top Contributors:
Interactively using checkboxes in Word
Checkbox (Yes) Checkbox (No)
A. Checkbox (...)
B. Checkbox (...)
C. Checkbox (...)
D. Checkbox (...)
I want to do the following:
- Enable the Yes and No checkboxes always.
- Disable the A-D checkboxes as a default. If the No checkbox is selected (checked), keep them disabled. If the Yes checkbox is selected (checked), enable them so that the user can check one of them.
Note: My document has a few of these "questions". So, it may be a bit more tricky than meets the eye.
Any suggestions?
Also - I am using Word on both the Mac and Windows. If necessary, I will use a Windows solution.
Report abuse
Thank you.
Reported content has been submitted
Mary,
Interesting question and perfect timing. I just recently published an add-in for creating mutually exclusive option buttons in Word. It appears that it is really option buttons that you want. You want the user to be able to select either yes or no but not both and if yes is check then you want them to check A, B, C or D no?
Using the following add-in you can create the two groups of option buttons.
http://gregmaxey.mvps.org/word_tip_pages/mutually_exclusive_content_control_option_buttons.html
Assuming that you tag the Yes\No group as 1 and the ABCD group as 2, then adding the following code in the document's ThisDocument module should give you the results you need:
'Add these lines immediately after the Dim bRecheck as Boolean statement in the Sub Document_ContentControlOnChange procedure.
If ActiveDocument.SelectContentControlsByTag("optGrp1_M_2").Item(1).Checked Then
ActiveDocument.SelectContentControlsByTag("optGrp2_O_1").Item(1).Checked = False
ActiveDocument.SelectContentControlsByTag("optGrp2_O_2").Item(1).Checked = False
ActiveDocument.SelectContentControlsByTag("optGrp2_O_3").Item(1).Checked = False
ActiveDocument.SelectContentControlsByTag("optGrp2_O_4").Item(1).Checked = False
ActiveDocument.SelectContentControlsByTag("optGrp2_O_1").Item(1).LockContents = True
ActiveDocument.SelectContentControlsByTag("optGrp2_O_2").Item(1).LockContents = True
ActiveDocument.SelectContentControlsByTag("optGrp2_O_3").Item(1).LockContents = True
ActiveDocument.SelectContentControlsByTag("optGrp2_O_4").Item(1).LockContents = True
Else
ActiveDocument.SelectContentControlsByTag("optGrp2_O_1").Item(1).LockContents = False
ActiveDocument.SelectContentControlsByTag("optGrp2_O_2").Item(1).LockContents = False
ActiveDocument.SelectContentControlsByTag("optGrp2_O_3").Item(1).LockContents = False
ActiveDocument.SelectContentControlsByTag("optGrp2_O_4").Item(1).LockContents = False
End If
I've put a working example in dropbox:
https://dl.dropboxusercontent.com/u/64545773/Demo%20Option%20Buttons.docm
***
Death smiles at us all, but all a man can do is smile back.
For more help with Word visit:
http://gregmaxey.com/word_tips.html
Report abuse
Thank you.
Reported content has been submitted
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
I am not certain how to add the code, though. Can you point me in the right direction - so I can add it?
Also, I cannot figure out how to download the stuff from your site.
Thanks again,
Mary
Report abuse
Thank you.
Reported content has been submitted
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
I already added the code to the demo document. To see it, just open the file, and open the VB Editor (ALT+F11) and open the "ThisDocument" module of the project.
See: http://gregmaxey.mvps.org/word_tip_pages/installing_employing_macros.html for some navigation tips in the VBE.
You download the add-in using the "Templates" link at the bottom of the tips page.
***
Death smiles at us all, but all a man can do is smile back.
For more help with Word visit:
http://gregmaxey.com/word_tips.html
Report abuse
Thank you.
Reported content has been submitted
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
OK - need to revisit this.
Because... I am working with a 'template' document that users will be copying from a SharePoint site/location to a desired network/desktop location for modification and renaming according to the project being worked on.
So, I cannot protect the entire document.
Can I accomplish my goal with a user form within the document? Or should I be using Excel - in other words, is Excel the better solution? (With Visual Basic of course)
I appreciate ANY suggestions. Especially because my contract is ending March 31st and I would like to resolve this. (I have been working on other items with respect to these 'templates'.)
Kind regards,
Mary
P.S. I have been investigating how to create a userform within documents etc. and have not been able to find anything - perhaps I am not looking in the correct locations???
Report abuse
Thank you.
Reported content has been submitted
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Report abuse
Thank you.
Reported content has been submitted
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Thanks, Peter.
If I code it in Windows-based (Microsoft Windows Parallels on my Mac) VB/Word 2010, can users use the code on the Mac side? If not, I can direct them to use it on the Windows side... although not desirable...
I actually had a document working with checkboxes, but it only contained sample text and was protected. Also, it did not contain the rest of the document in which the checkboxes etc. will be. And, the check boxes (and sample text) were not in a user form.
Any suggestions on including my scenario in a document?
Thanks again,
Mary
Report abuse
Thank you.
Reported content has been submitted
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
If you are using Parallels on Mac to run Windows, and running Word on that, then it is the same as running Windows Word on a standalone copy of Windows. Unless you are using something like a Starter Edition of Office, COntent Controls and macros should work much the same way on Word 2010 and 2013.
It's the "Word 2011 for Mac" that runs directly on Mac OSX that is different.
Both Windows Word and Mac Word 2011 can use "legacy forms" for checkboxes in the document surface, and allow you to protect individual sections in the document, so you can set things up so that only the parts with the form fields are protected, and other sections are protected.
Both Windows Word and Mac Word 2011 can also work with VBA Userforms - these do not appear in the document surface, but as separate dialog boxes. If you need the information that the user enters in the form to appear in the document, you will need VBA that can transfer the information. Precisely how to do that depends on what you need to achieve.
I can't go into more detail right now, but may be able to do so in a couple of days.
Report abuse
Thank you.
Reported content has been submitted
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Thanks very much, Peter.
In the meantime, I will investigate - and have been... (unfortunately, so far I can only insert one control at a time)
My contract is expiring on the 31st, so would you mind talking this over briefly? My cell is 508-315-7146.
My time is EST.
Thanks,
Mary
Report abuse
Thank you.
Reported content has been submitted
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
> My contract is expiring on the 31st, so would you mind talking this over briefly?
That won't be possible, sorry.
Report abuse
Thank you.
Reported content has been submitted
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Question Info
Last updated October 5, 2021 Views 2,117 Applies to: