Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 07-06-2014, 10:13 AM
lucky16 lucky16 is offline More than one content controls in a word document Windows 7 32bit More than one content controls in a word document Office 2007
Novice
More than one content controls in a word document
 
Join Date: Jan 2014
Posts: 21
lucky16 is on a distinguished road
Default

These are content control depended dropdowns. When an item from the content control dropdown is selected, dependent text is inseretd in the next line. Following is the code i am using.

Quote:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With ContentControl
If .Title = "Client" 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

With ContentControl
If .Title = "Delivery contacts" 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(3).Range.Text = StrDetails
End If
End With
End Sub
Trying to have these dependent dropdowns side by side.

Thank you.
Reply With Quote
 

Tags
vba in microsoft word, vba word



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use onchange event for content controls in word lucky16 Word VBA 7 06-06-2014 05:05 AM
More than one content controls in a word document MS Word 2010 Content Controls and PDF Conversion. MaxInCO Word 3 02-13-2014 12:58 PM
Word 2010 Macro Enabled Template with Content Controls keen1598 Word VBA 7 01-29-2014 03:17 PM
Disabling content controls and protecting document sections. Catty Word VBA 2 11-29-2013 05:10 AM
Using both rich and plain content controls in one document Erica.Black Word 0 06-18-2013 10:33 AM

Other Forums: Access Forums

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