#1
|
|||
|
|||
Insert text and fieldformtext when dropdown selected
I want to add standard text in bold if possible then a form text if my drop down is selected as yes.
Similarly I want this specific drop down and text to go away if the form is reset. It would look something like: On Protocol: {FORMDROPDOWN} (called ddProtocol with 3 options Choose One, Yes, No) If yes is selected tab from drop down bold: Refer to Protocol: {FORMTEXT} labeled Protocoltest If Choose One or No are selected make sure none of the above items are occurring but don't just delete every form text field because there are a lot of others in the full document. Abbreviated version of the code is as follows which I tried to just get the option to work if I selected Yes and makes the form text field appear RIGHT behind the ddProtocol and there is no text showing: Dim xProtocol As FormField Dim xState As FormField On Error Resume Next Set xProtocol = ActiveDocument.FormFields("ddProtocol") Set xState = ActiveDocument.FormFields("ddConstraints") With xState.DropDown.ListEntries .Clear Select Case xProtocol.Result Case "Yes" Options.ReplaceSelection = False With Selection Selection.TypeText vbTab & "Refer to Protocol:" & vbTab End With Selection.Collapse Direction:=wdCollapseEnd Set ffield = ActiveDocument.FormFields _ .Add(Range:=Selection.Range, Type:=wdFieldFormTextInput) With ffield .Name = "Protocoltest" .TextInput.EditType Type:=wdRegularText .TextInput.Width = 11 End With Case "No" ' Insert code to erase here End Select End With Thanks for your help!! |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using a dropdown box to fill out multiple text fields and insert a bb image | CSEShop | Word VBA | 2 | 12-27-2022 02:17 PM |
Duplicating dropdown box but also removing text in paragraphs when option is not selected | arty1 | Word VBA | 2 | 08-08-2020 09:30 PM |
Conditionally Color Formatting Text selected from a dropdown list in Word 2010 | pgammag | Word | 9 | 08-20-2019 04:17 PM |
Assign selected value from DropDown to a variable | jhansrod | Word VBA | 3 | 06-13-2019 04:46 PM |
Macro to insert different sets of text at bookmark depending on sequence of selected check boxes | chipper09 | Word VBA | 0 | 06-21-2018 01:49 PM |