![]() |
|
|
Thread Tools | Display Modes |
#2
|
||||
|
||||
![]()
For example, assuming you first select all the options:
Code:
Sub AddComboBox() Application.ScreenUpdating = False Dim objCC As ContentControl, StrTxt As String, i As Long With Selection.Range If InStr(.Text, "[") = 0 Then Exit Sub If InStr(.Text, "]") = 0 Then Exit Sub If .Characters.Last <> "]" Then .MoveEndUntil "]", wdBackward StrTxt = .Text StrTxt = Replace(StrTxt, "]", "") .Text = vbNullString Set objCC = .ContentControls.Add(wdContentControlComboBox) With objCC .SetPlaceholderText Text:="Please make a selection" For i = 1 To UBound(Split(StrTxt, "[")) .DropdownListEntries.Add Split(StrTxt, "[")(i) Next End With End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
content control, microsoft word, vba content control |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
someazguy | Word VBA | 14 | 02-05-2023 08:01 PM |
Clear all content controls (Text, dropdown) AND change option button values to FALSE in MS Word Form | Janet D | Word VBA | 7 | 01-14-2023 02:36 AM |
![]() |
Mightymegs | Word VBA | 6 | 05-18-2020 05:34 AM |
![]() |
jeffreybrown | Word VBA | 15 | 02-20-2017 05:35 PM |
Macro to save docx to doc that checks compatibility and converts content controls to static content. | staicumihai | Word VBA | 4 | 10-12-2016 08:23 PM |