Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-13-2018, 09:28 AM
PointCheck PointCheck is offline Error Message Windows 10 Error Message Office 2016
Novice
Error Message
 
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
  #2  
Old 08-13-2018, 02:42 PM
macropod's Avatar
macropod macropod is offline Error Message Windows 7 64bit Error Message Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your code is evidently derived from:
https://www.msofficeforums.com/word-...html#post46903
For different elements from a selected item to be output to different content controls, see:
https://www.msofficeforums.com/word-...tml#post120392
later is the same thread.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
No known fix for this error message... Aymincendiary PowerPoint 1 09-03-2017 05:38 PM
Error Message Reserved error(-1517); there is no message for this error ktest Office 1 02-12-2016 08:08 PM
Error Message Automation error Unknown error" message once they open the Excel file hlina Excel 1 10-08-2013 09:14 PM
Error message White House Outlook 1 12-07-2010 04:52 AM
sent mail error message Carolemc Outlook 0 09-26-2006 03:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft