Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-17-2023, 01:42 PM
ireneb ireneb is offline Insert text and fieldformtext when dropdown selected Windows 10 Insert text and fieldformtext when dropdown selected Office 2019
Novice
Insert text and fieldformtext when dropdown selected
 
Join Date: Jan 2023
Posts: 2
ireneb is on a distinguished road
Default 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!!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert text and fieldformtext when dropdown selected 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
Insert text and fieldformtext when dropdown selected Conditionally Color Formatting Text selected from a dropdown list in Word 2010 pgammag Word 9 08-20-2019 04:17 PM
Insert text and fieldformtext when dropdown selected 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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:38 AM.


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