Thread: Error Message
View Single Post
 
Old 08-13-2018, 09:28 AM
PointCheck PointCheck is offline Windows 10 Office 2016
Novice
 
Join Date: Aug 2018
Posts: 3
PointCheck is on a distinguished road
Default Error Message

I have a question:

Based on a selection in a Combo Box of either Akron, Cincinnati, Columbus, Dayton, Youngstown. Populate five different Text Box?

For example, If I select "Akron" in the Combo Box? The following Text Boxes would populate. see below

Combo Box 1 = Akron
Text Box 1 = Kim Lee
Text Box 1 = 123 No Name Street
Text Box 1 = Cols, Oh 45623
Text Box 1 = 214-567-8954
Text Box 1 =
klee@msn.com



It was suggested to use the following code:
I put the example in my letter. In the letter, I also have other Combo boxes. When I add the code below I get an error in the code (Orange section). Can you assist?

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With ContentControl
If .Title = "MBACRegion" 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
___________________________________________
Any assistance would be great.
Reply With Quote