Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-03-2019, 08:55 AM
leyper leyper is offline How do I get a radio button or radio group to return its value(s) to a text field using VBA? Windows 10 How do I get a radio button or radio group to return its value(s) to a text field using VBA? Office 2010
Novice
How do I get a radio button or radio group to return its value(s) to a text field using VBA?
 
Join Date: Apr 2019
Posts: 1
leyper is on a distinguished road
Default How do I get a radio button or radio group to return its value(s) to a text field using VBA?

I've put together a protected form in Word that, once completed, the user will submit by email. Ideally the email would contain the form pasted into the body of the email rather than as an attachment, but as the form is protected there's no way the user can unprotect the document, "select all", copy and re-protect the document.



So I have provided two options for the user: 1) a Submit button at the end of the form which fires up a blank email with the completed form as an attachment (via the SendMail command). 2) A "copy to clipboard" button which copies the entire Word doc content to the clipboard without the need for the user to unlock and re-lock the document. The user can then manually paste that content into the body of the outgoing email.

This work fine up to a point: when the email is sent to a recipient, controls such as radio buttons and dropdowns won't display for the recipient. All other parts of the form including text fields display as intended.

As a workaround I want to add additional text fields beneath any radio button groups and dropdown lists. I would like these text fields to reflect the selections made using the associated controls. i.e. if the user chooses "No" from a Yes/No radio button group, then the text field beneath that group will populate with the text "No" (because I know that field text will display in the recipient's email even if the actual radio/list control doesn't). The same goes for dropdown lists; whatever the user selects from the list should display in the text field next to the list.

Is there a way/piece of VBA code that will allow a control to "export" its value to a text field?

The two control types I am using are radio buttons groups (Yes/No) and dropdown lists. The rest of the form contains text fields (which work fine).

Thanks.
Reply With Quote
  #2  
Old 04-03-2019, 09:38 PM
gmayor's Avatar
gmayor gmayor is offline How do I get a radio button or radio group to return its value(s) to a text field using VBA? Windows 10 How do I get a radio button or radio group to return its value(s) to a text field using VBA? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

I assume by protected form you are talking about a protected form using legacy form fields?

Legacy form fields are not compatible with radio buttons, though you can emulate them with check boxes and macro code; however macros required to make a form work should not be used in e-mailed documents as they tend to fall foul of security arrangements and you have no ability to force users to run them as that would open the window to malicious code.

I would also recommend that you don't copy the form to the body of the e-mail message. For one thing it won't work as you have found and for another, you have no control over the e-mail client that the recipient uses and not all behave similarly.

Furthermore, collating data from e-mail messages is rather more complicated than doing so from Word documents, so you are just making the job more difficult for yourself.

I would recommend that you convert the form to use content controls. To aid that you may find http://www.gmayor.com/insert_content_control_addin.htm useful, and send the form, without macros as an attachment.

Content controls are much faster to process than form fields (especially with Word 2010 which is up to 6 times faster than later versions). You can have the form protected - the above link explains more - or you can just protect the fields. There is no radio button control, but you can use list boxes to achieve the same end.

http://www.gmayor.com/ExtractDataFromForms.htm will help with the data extraction.

Have you considered making the form as a web page on the company web site and providing a link to it?
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply

Tags
form fields, radio button, vba code



Similar Threads
Thread Thread Starter Forum Replies Last Post
Option/Radio Button,Group box 1 & 2 ... Kwmck328 Excel 0 02-19-2015 09:26 PM
How do I get a radio button or radio group to return its value(s) to a text field using VBA? Radio Button Problem cesarica Word 2 01-08-2015 08:02 AM
How do I get a radio button or radio group to return its value(s) to a text field using VBA? Circling your selection on word vs check box or radio button NBuckley Word 2 04-04-2014 03:17 AM
My First Attempt at Form Creation: Input of Text via Check Box or Radio Button tatihulot Excel 0 08-15-2013 06:11 AM
How do I get a radio button or radio group to return its value(s) to a text field using VBA? Radio (options button) problem Niros Excel 1 11-24-2005 09:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft