![]() |
#1
|
|||
|
|||
![]()
Hello All,
I should preface this with the fact that I am quite new to VBA and Macros and am still learning the basics. I'm trying to build a form within a table that contains a drop-down list (Combo Box - as I want the user to have the option of entering their own value if none of the options meet their requirements) of options that I want the user to be able to select from. Once the user has selected an option, I want a custom paragraph to appear within a rich text content control (RTCC) box which is located later in the document. From what I understand, the best way to do this is to have each custom paragraph in a separate RTCC with its own "title". So that once mapped to the drop-down list, the specific RTCC is the only one visible when an option from the drop-down list is selected. I would prefer that none of the RTCCs are visible if no option has yet been selected purely for aesthetic reasons but I am willing to let this slide. Also, it would be ideal if the custom paragraphs updated "OnChange", however "OnExit" is good too. So far, I've been able to add titles to each RTCC and the following code down: Sub ShowParagraph() Dim sParagraph As String sParagraph = ActiveDocument.ContentControls("Combo Box").Range.Text Select Case sParagraph Case "BCA_DCC" ActiveDocument.ContentControls("BCA_DCC.TXT").Rang e.Text = "This is paragraph 1" Case "BCA_NODCC" ActiveDocument.ContentControls("BCA_NODCC.TXT").Ra nge.Text = "This is paragraph 2" Case "SOA_DCC" ActiveDocument.ContentControls("SOA_DCC.TXT").Rang e.Text = "This is paragraph 3" Case "SOA_NODCC" ActiveDocument.ContentControls("SOA_NODCC.TXT").Ra nge.Text = "This is paragraph 4" End Select End Sub Where values e.g., "BCA_DCC" are options in the drop-down list and "BCA_DCC.TXT" are titles for their corresponding RTCC containing custom paragraphs. Note: I am using the latest version of Word. Any feedback would be highly appreciated! Best, Aarish |
Tags |
content controls, macros, vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
borus | Word | 3 | 08-16-2023 05:36 AM |
Text based on selection of dropdown list | cloud67 | Word VBA | 2 | 08-09-2019 06:46 AM |
Copy Formatted Text in one Rich Text Content Control to another Rich Text Content Control | Haygordon | Word | 1 | 04-05-2019 05:43 AM |
![]() |
nikesh01 | Word VBA | 1 | 02-05-2016 01:06 PM |
VBA: How to place dropdown list next to text | YigalB | Word VBA | 0 | 08-11-2013 01:48 PM |