Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 01-11-2021, 08:38 AM
gmaxey gmaxey 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
Programatically create Fully Functional DropdownList (or ComboBox) Content Controls
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,600
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Paul, Graham


Graham appears to be correct. It seems my habit of using vbNullString in code has bitten me here. Revising my earlier Attempt2:

Code:
Sub Attempt5()
Dim oCC As ContentControl
  Set oCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList, Selection.Range)
  With oCC.DropdownListEntries
    .Add oCC.PlaceholderText, ""  'Using vbNullString in this Attempt2 seems to have been the problem.
    .Add "A", "Apples"
    .Add "B", "Beets"
  End With
lbl_Exit:
  Exit Sub
End Sub
Appears to work as well.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



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 07:01 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