Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2021, 12:19 AM
gmayor's Avatar
gmayor gmayor is offline Programatically create Fully Functional DropdownList (or ComboBox) Content Controls Windows 10 Programatically create Fully Functional DropdownList (or ComboBox) Content Controls Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default


What you need is
Code:
Sub Macro1()
Dim oCC As ContentControl
    Set oCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList, Selection.Range)
    With oCC
        .Title = "My List Box"
        .Tag = .Title
        .LockContentControl = False
        .SetPlaceholderText , , "Select Fruit"
        .DropdownListEntries.Add Text:=.PlaceholderText, value:=""
        .DropdownListEntries.Add Text:="Apples", value:="Apples"
        .DropdownListEntries.Add Text:="Pears", value:="Pears"
        .DropdownListEntries.Add Text:="Plums", value:="Plums"
        .DropdownListEntries.Add Text:="Grapes", value:="Grapes"
    End With
    Set oCC = Nothing
End Sub
or take a look at Insert Content Control Add-In
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Programatically create Fully Functional DropdownList (or ComboBox) Content Controls Pass combobox content to header wpryan Word VBA 3 07-17-2015 01:44 AM
VBA ppt ComboBox behaivor: 1.OnFocus change value 2. get dropdownlist doesn't disappear after mousec janism22 PowerPoint 2 03-26-2015 12:35 AM
Create UserForm ComboBox or ContentControl ptmuldoon Word VBA 11 01-17-2015 05:58 PM
How to use the content of a combobox for {IF} field? Melaanie Word 0 06-14-2010 02:00 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:03 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft