Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-20-2022, 11:11 AM
maric maric is offline Getting VBA code to run Concurrent with another Windows XP Getting VBA code to run Concurrent with another Office 2021
Novice
Getting VBA code to run Concurrent with another
 
Join Date: Jul 2022
Posts: 6
maric is on a distinguished road
Default Getting VBA code to run Concurrent with another

I'm working a document in word where I need there to be a series of 3 dropdowns. The first drop down allows you to pick a team. Once you select that team, certain names of that respective team appear with their contact information populate in the text box.

How do I get all 3 boxes to work together, where once you select the Team, then the contact name, the info populates in the contact detail box.

I already have two codes that I've gotten to work separately, but not together on the same document. I also need to be able to input this in different locations of the document without it changing previously entered information.
Attached Images
File Type: png Coding Request 2.png (7.2 KB, 16 views)
File Type: png Coding Request.png (86.7 KB, 16 views)
Attached Files
File Type: docm SAMPLE.docm (28.5 KB, 9 views)

Last edited by maric; 07-21-2022 at 06:12 AM.
Reply With Quote
  #2  
Old 07-20-2022, 12:11 PM
gmaxey gmaxey is offline Getting VBA code to run Concurrent with another Windows 10 Getting VBA code to run Concurrent with another Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

What is your question?
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 07-20-2022, 12:50 PM
maric maric is offline Getting VBA code to run Concurrent with another Windows XP Getting VBA code to run Concurrent with another Office 2021
Novice
Getting VBA code to run Concurrent with another
 
Join Date: Jul 2022
Posts: 6
maric is on a distinguished road
Default

How can I combine the two codes to work together within the one document? Currently the code between Service teams and contact members work, however I cant get the contact details to appear into the text box.
Reply With Quote
  #4  
Old 07-20-2022, 03:52 PM
Guessed's Avatar
Guessed Guessed is offline Getting VBA code to run Concurrent with another Windows 10 Getting VBA code to run Concurrent with another Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Post a document with your working code and Content Controls so someone can add the additional coding for contact details.

The contact details can be manually entered in the code or it can be stored in a non-vba location which would make those contact details easier to maintain.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 07-21-2022, 10:23 AM
maric maric is offline Getting VBA code to run Concurrent with another Windows XP Getting VBA code to run Concurrent with another Office 2021
Novice
Getting VBA code to run Concurrent with another
 
Join Date: Jul 2022
Posts: 6
maric is on a distinguished road
Default

Would you be able to take a look at it?
Reply With Quote
  #6  
Old 07-21-2022, 12:39 PM
gmaxey gmaxey is offline Getting VBA code to run Concurrent with another Windows 10 Getting VBA code to run Concurrent with another Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Just nest your two "If .Title .... End If" statements in your With CCtrl ... End If statement.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #7  
Old 07-21-2022, 12:57 PM
maric maric is offline Getting VBA code to run Concurrent with another Windows XP Getting VBA code to run Concurrent with another Office 2021
Novice
Getting VBA code to run Concurrent with another
 
Join Date: Jul 2022
Posts: 6
maric is on a distinguished road
Default

Would you be able to actually write out the exact code. As I'm still getting a debug message.
Reply With Quote
  #8  
Old 07-21-2022, 12:59 PM
gmaxey gmaxey is offline Getting VBA code to run Concurrent with another Windows 10 Getting VBA code to run Concurrent with another Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

What debug message? We (or at least I am) are not here to write code for you! Where is the complete segment of code that you have written?
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #9  
Old 07-21-2022, 01:11 PM
maric maric is offline Getting VBA code to run Concurrent with another Windows XP Getting VBA code to run Concurrent with another Office 2021
Novice
Getting VBA code to run Concurrent with another
 
Join Date: Jul 2022
Posts: 6
maric is on a distinguished road
Default

I meant a compile error and as provided in the attachments above, I already have both codes written. I'm just having trouble getting them to work together. That's why I came to this forum, for help! Also as you can see in another comment I was told to add the document so that someone could help with the additional coding needed.
Reply With Quote
  #10  
Old 07-21-2022, 01:54 PM
gmaxey gmaxey is offline Getting VBA code to run Concurrent with another Windows 10 Getting VBA code to run Concurrent with another Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

I saw very little evidence in your attached document where you had made any effort to combine the code as I suggested.



Code:
Option Explicit
Dim StrOption As String
Private Sub Document_ContentControlOnEnter(ByVal CCtrl As ContentControl)
If CCtrl.Title = "Service Team" Then StrOption = CCtrl.Range.Text
End Sub
 
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim i As Long, StrOut As String
Dim strDetails As String
With CCtrl
  If .Title = "Service Team" Then
    If StrOption = .Range.Text Then Exit Sub
    Select Case .Range.Text
    Case "Producer"
        StrOut = "Apples,Banna,Pear,Oranges"
    Case "Account Manager"
        StrOut = "Math,History,English,Art"
    Case "Claims Advocate"
        StrOut = "Scissors,Paper,Rock"
    Case Else
        .Type = wdContentControlText
        .Range.Text = ""
        .Type = wdContentControlDropdownList
    End Select
    With ActiveDocument.SelectContentControlsByTitle("Contact Name")(1)
    .DropdownListEntries.Clear
    For i = 0 To UBound(Split(StrOut, ","))
        .DropdownListEntries.Add Split(StrOut, ",")(i)
    Next
    .Type = wdContentControlText
    .Range.Text = ""
    .Type = wdContentControlDropdownList
    End With
  End If
  If .Title = "Contact Name" 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.SelectContentControlsByTitle("Contact Details").Item(1).Range.Text = strDetails
  End If
End With
Application.ScreenUpdating = True
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #11  
Old 07-22-2022, 06:42 AM
maric maric is offline Getting VBA code to run Concurrent with another Windows XP Getting VBA code to run Concurrent with another Office 2021
Novice
Getting VBA code to run Concurrent with another
 
Join Date: Jul 2022
Posts: 6
maric is on a distinguished road
Default

I was trying to be helpful keeping them separated, however I appreciate the time you took to look at it, thank you.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting VBA code to run Concurrent with another List of ascii code of Character Symbols or code for all symbols used in Word SamDsouza Word VBA 3 03-12-2020 04:49 AM
Getting VBA code to run Concurrent with another AutoOpen code to change date code to date text Legal Learning Center Word VBA 6 02-22-2020 02:24 PM
Getting VBA code to run Concurrent with another Enabling concurrent multiple editors of 1 word document over network drive. tyrese213 Word 4 01-02-2019 06:47 PM
Concurrent Calls in Excel sbcccc Excel 1 08-15-2018 12:24 AM
Getting VBA code to run Concurrent with another VBA Code to search for field codes with certain text before the Field code and to change style welcometocandyland Word VBA 4 02-08-2017 06:53 PM

Other Forums: Access Forums

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