View Single Post
 
Old 01-11-2021, 08:29 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,428
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Guess,


I didn't see the tree for the forest. Thanks. I've modified a bit as Attempt5 because with your Attempt4, an error would occur if the CC just created is not the first indexed in the selection paragraph.

Code:
Sub Attempt5()
Dim oRng As Range
Dim oCC As ContentControl
  Set oRng = Selection.Range
  Application.CommandBars.ExecuteMso ("ContentControlDropDownList")
  oRng.End = oRng.End + 2
  Set oCC = oRng.ContentControls(1)
  With oCC
    .DropdownListEntries.Add "A", "Apples"
    .DropdownListEntries.Add "B", "Beets"
    'Result: A fully functional DDL content control.
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote