Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-02-2021, 10:30 PM
cookietyrant cookietyrant is offline Content Controls - Multiple Drop Downs - VBA Windows 10 Content Controls - Multiple Drop Downs - VBA Office 2019
Novice
Content Controls - Multiple Drop Downs - VBA
 
Join Date: Aug 2021
Posts: 2
cookietyrant is on a distinguished road
Angry Content Controls - Multiple Drop Downs - VBA

Basically I have 2 Fields of which I want to have a drop down for with unique data the below code works perfectly for my Project manager section, but then when I want to run it against the engineer section it won't fill in the Engineer details section...I'm assuming there is some sort of join or piece of code I'm missing to get multiple drop downs utilizing the below code to act independent of each other.

I attached a screen shot of which may help show what I'm trying to do...



HTML Code:
Option Explicit

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With ContentControl
  If .tag = "ProjectManager" Then
  For i = 1 To .DropdownListEntries.Count
    If .DropdownListEntries(i).Text = .Range.Text Then
      StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
      Exit For
    End If
  Next
  ActiveDocument.ContentControls(2).Range.Text = StrDetails
  End If
End With
End Sub
HTML Code:
Option Explicit

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With ContentControl
  If .tag = "Engineer" Then
  For i = 1 To .DropdownListEntries.Count
    If .DropdownListEntries(i).Text = .Range.Text Then
      StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
      Exit For
    End If
  Next
  ActiveDocument.ContentControls(2).Range.Text = StrDetails
  End If
End With
Attached Images
File Type: png Word Table.PNG (45.1 KB, 17 views)
Reply With Quote
 

Tags
content controls, drop down list, word 2019



Similar Threads
Thread Thread Starter Forum Replies Last Post
Content Controls - Multiple Drop Downs - VBA Cascading drop-downs in Word with one parent menu and four dependent drop-downs mrstrawhand Word VBA 3 03-30-2020 06:08 AM
Populating multiple Content Controls after mail merge guiltyvictim Word VBA 3 07-30-2019 09:27 AM
Content Controls - Multiple Drop Downs - VBA Content Controls (Drop Down copy and paste), and XML mapping dezdelaina Word 3 03-05-2018 06:50 PM
Content Controls - Multiple Drop Downs - VBA 2 drop down list content controls danfookes Word VBA 2 03-02-2018 02:05 AM
Content Controls - Multiple Drop Downs - VBA Inserting multiple content controls for a date jeffreybrown Word 2 05-09-2016 05:53 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:43 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