Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-01-2023, 05:43 AM
gmaxey gmaxey is offline auto-populating dropdown list Windows 10 auto-populating dropdown list Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

So if "A" is selected and the list items change from A, B, C to A.I, A.II and A.III, what is supposed to happen to the initially selected value "A" that is displayed?




Perhaps something like this:



Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim lngIndex As Long
  Select Case ContentControl.Title
    Case "Test"
      For lngIndex = ContentControl.DropdownListEntries.Count To 2 Step -1
         ContentControl.DropdownListEntries(lngIndex).Delete
      Next
      Select Case ContentControl.Range.Text
        Case "A"
           ContentControl.DropdownListEntries.Add "A.I", "A.I"
           ContentControl.DropdownListEntries.Add "A.II", "A.II"
           ContentControl.DropdownListEntries.Add "A.III", "A.III"
        Case "A.I"
           ContentControl.DropdownListEntries.Add "A.I.a", "A.I.a"
           ContentControl.DropdownListEntries.Add "A.I.b", "A.I.b"
           ContentControl.DropdownListEntries.Add "A.I.c", "A.I.c"
        Case "B"
           ContentControl.DropdownListEntries.Add "B.I", "B.I"
           ContentControl.DropdownListEntries.Add "B.II", "B.II"
           ContentControl.DropdownListEntries.Add "B.III", "B.III"
        Case "C"
           ContentControl.DropdownListEntries.Add "C.I", "C.I"
           ContentControl.DropdownListEntries.Add "C.II", "C.II"
           ContentControl.DropdownListEntries.Add "C.III", "C.III"
      End Select
  End Select
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply

Tags
auto fill, content control events, dropdown list



Similar Threads
Thread Thread Starter Forum Replies Last Post
auto-populating dropdown list Auto-populating tables with 3 different conditions Deichgraf Excel 4 02-07-2023 08:58 AM
Auto-populating a word document csmall86 Word 1 12-20-2019 01:54 PM
auto-populating dropdown list Auto populate a text field based on Content Control Dropdown List matthias92701 Word VBA 2 05-02-2019 03:54 PM
auto-populating dropdown list UserForm Dropdown List Not Populating highrise955 Word VBA 14 04-10-2016 12:10 PM
auto-populating dropdown list Need help populating dropdown box antztaylor Word 3 11-06-2012 05:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:39 AM.


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