Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-02-2018, 08:35 PM
someazguy someazguy is offline Content Controls - Dependent Dropdown Windows 7 32bit Content Controls - Dependent Dropdown Office 2016 for Mac
Novice
Content Controls - Dependent Dropdown
 
Join Date: Apr 2018
Posts: 5
someazguy is on a distinguished road
Default Content Controls - Dependent Dropdown

Hey guys,



I figured I would join this forum to ask if anyone can help me on a project that I working on for my company's sales department.

I am stuck at the final part of the form that will be used for signing on new service agreements.

I created a form for the first page that can be filled in with the new client's information, and their information would automatically be transferred to the next page which is a termination of service letter for their current vendor. The last part I need is to have a set of 4 dependent drop-down boxes.

First box is the manager's name of the current vendor they are cancelling with.

I want this box to be the "master" or "control" box... When any of the 7+/- names that are in the box are selected, the following 3 boxes will be that company's name, then their address, then their phone number. Basically I want the three dependent boxes under the "master" to auto populate the correct information for that company once the one of the dependent boxes are selected.

I am horrible with VBA and I honestly had to go online and copy someone else's code just to get two boxes to work.

I am getting frustrated!

Any advice? Or can any one copy the correct blank VBA code that I can fill in for 4 drop-down boxes?

If anyone needs to see the document, please let me know and I can send it to you.

Thanks!
Reply With Quote
  #2  
Old 04-02-2018, 09:42 PM
Guessed's Avatar
Guessed Guessed is offline Content Controls - Dependent Dropdown Windows 10 Content Controls - Dependent Dropdown Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,490
Guessed is just really niceGuessed is just really niceGuessed is just really niceGuessed is just really niceGuessed is just really nice
Default

It sounds like you only need one drop down box and the other three can then be plain text CCs filled from some information source. The trick is deciding where to store the company name, address and phone number.

Do you have a table that lists the relevant information somewhere:
Manager; Company; Address; Phone

A non-coded method would be to store each of the variable information blocks in a particular building block Gallery and Category and then use a Building Block content control to allow the user to select one to insert all at once. This is actually pretty easy to set up and far easier than trying to solve it with a macro.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 04-02-2018, 09:51 PM
macropod's Avatar
macropod macropod is offline Content Controls - Dependent Dropdown Windows 7 64bit Content Controls - Dependent Dropdown Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,040
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

See: https://www.msofficeforums.com/word-...html#post46903 and, for different elements from a selected item to be output to different content controls, see: https://www.msofficeforums.com/word-...tml#post120392
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #4  
Old 04-03-2018, 05:41 PM
someazguy someazguy is offline Content Controls - Dependent Dropdown Windows 7 32bit Content Controls - Dependent Dropdown Office 2016 for Mac
Novice
Content Controls - Dependent Dropdown
 
Join Date: Apr 2018
Posts: 5
someazguy is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
See: https://www.msofficeforums.com/word-...html#post46903 and, for different elements from a selected item to be output to different content controls, see: https://www.msofficeforums.com/word-...tml#post120392
Alright,

I followed the first link that you sent me and inserted it into my form.

Now, every time I go to select an item from the drop down menu, it auto populates the 3 lines of text into every other content control box on form?

Any ideas? Can I send you the document and have you take a look at it?

Thanks for the swift reply!
Reply With Quote
  #5  
Old 04-03-2018, 05:50 PM
macropod's Avatar
macropod macropod is offline Content Controls - Dependent Dropdown Windows 7 64bit Content Controls - Dependent Dropdown Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,040
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

Can you attach the document to a post with some representative content(delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #6  
Old 04-03-2018, 06:12 PM
someazguy someazguy is offline Content Controls - Dependent Dropdown Windows 7 32bit Content Controls - Dependent Dropdown Office 2016 for Mac
Novice
Content Controls - Dependent Dropdown
 
Join Date: Apr 2018
Posts: 5
someazguy is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Can you attach the document to a post with some representative content(delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
Here it is. Everything is mapped correctly except on the termination letter. I just need to be able to select companies from that drop down and have it populate into the letter head, not the entire document.

Let me know what I am doing wrong.

Thanks!
Attached Files
File Type: docm Service Agreement and Term Letter with Macros.docm (68.5 KB, 5 views)
Reply With Quote
  #7  
Old 04-03-2018, 06:40 PM
macropod's Avatar
macropod macropod is offline Content Controls - Dependent Dropdown Windows 7 64bit Content Controls - Dependent Dropdown Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,040
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

As coded, the ContentControlOnExit macro you're using outputs all the secondary data to the second content control in the document. Apparently, you have that content control (which appears on the first page), linked to the corresponding content controls on the second page and, for whatever reason, those content controls don't allow line breaks. In any event, given your document's layout, you probably need to use a ContentControlOnExit implementation along the lines of the second link I gave you.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #8  
Old 04-03-2018, 06:59 PM
someazguy someazguy is offline Content Controls - Dependent Dropdown Windows 7 32bit Content Controls - Dependent Dropdown Office 2016 for Mac
Novice
Content Controls - Dependent Dropdown
 
Join Date: Apr 2018
Posts: 5
someazguy is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
As coded, the ContentControlOnExit macro you're using outputs all the secondary data to the second content control in the document. Apparently, you have that content control (which appears on the first page), linked to the corresponding content controls on the second page and, for whatever reason, those content controls don't allow line breaks. In any event, given your document's layout, you probably need to use a ContentControlOnExit implementation along the lines of the second link I gave you.
Is there any way that I could potentially get you to assist me with that?

I am still very new to this and would like to complete my template.
Reply With Quote
  #9  
Old 04-03-2018, 07:26 PM
macropod's Avatar
macropod macropod is offline Content Controls - Dependent Dropdown Windows 7 64bit Content Controls - Dependent Dropdown Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,040
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

Try the attached. I had to do a bit of guesswork as to what data goes where, but it should give you something to work from.
Attached Files
File Type: docm Service Agreement and Term Letter.docm (77.0 KB, 14 views)
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #10  
Old 04-03-2018, 09:34 PM
Guessed's Avatar
Guessed Guessed is offline Content Controls - Dependent Dropdown Windows 10 Content Controls - Dependent Dropdown Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,490
Guessed is just really niceGuessed is just really niceGuessed is just really niceGuessed is just really niceGuessed is just really nice
Default

Paul
I think the data was supposed to go into the CC immediately below the drop down. In which case, the code should have been
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
  Dim i As Long, StrDetails As String, aCC As ContentControl
  With ContentControl
    If .Title = "Current Vendor" 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
      For Each aCC In ActiveDocument.SelectContentControlsByTitle("Current Vendor Info")
        aCC.Range.Text = StrDetails
      Next aCC
    End If
  End With
End Sub
However, I still recommend using a Building Block content control solution which doesn't need any code as shown in the attachment. As a side benefit, using the building blocks allows you to format that vendor and vendor address information.

Once you settle on a method for doing the Vendor info, you will need to address the repeating info so that you don't have to repeat filling out the same info in multiple places such as (Property Name). Greg Maxey has a good tool available to assist with this - see https://gregmaxey.com/word_tip_pages...rol_tools.html
Attached Files
File Type: dotx Service Agreement and Term Letter.dotx (61.9 KB, 10 views)
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #11  
Old 04-04-2018, 01:07 PM
someazguy someazguy is offline Content Controls - Dependent Dropdown Windows 7 32bit Content Controls - Dependent Dropdown Office 2016 for Mac
Novice
Content Controls - Dependent Dropdown
 
Join Date: Apr 2018
Posts: 5
someazguy is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Try the attached. I had to do a bit of guesswork as to what data goes where, but it should give you something to work from.
I opened the attached, it still presented the same issue.

Quote:
Originally Posted by Guessed View Post
Paul
I think the data was supposed to go into the CC immediately below the drop down. In which case, the code should have been.......

However, I still recommend using a Building Block content control solution which doesn't need any code as shown in the attachment. As a side benefit, using the building blocks allows you to format that vendor and vendor address information.
Guessed, I did like the way you set it up on the document you attached. How do I go in and edit the quick parts? Like mentioned in the original post, I will need to add about 7+/- vendors to the drop-down list.

Thanks guys!
Reply With Quote
  #12  
Old 04-04-2018, 02:58 PM
macropod's Avatar
macropod macropod is offline Content Controls - Dependent Dropdown Windows 7 64bit Content Controls - Dependent Dropdown Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,040
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

Quote:
Originally Posted by someazguy View Post
I opened the attached, it still presented the same issue.
As I said previously, that's because you're using linked content controls. In any event, it's only the linked content controls with the same title that are getting the duplicate content, not all content controls. And, given your document's structure, that's what I'd have thought was your intention.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #13  
Old 04-04-2018, 05:29 PM
Guessed's Avatar
Guessed Guessed is offline Content Controls - Dependent Dropdown Windows 10 Content Controls - Dependent Dropdown Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,490
Guessed is just really niceGuessed is just really niceGuessed is just really niceGuessed is just really niceGuessed is just really nice
Default

To create a new quick part, go to the end of the document and create the content you want in it. Then select that content (hint: experiment with including the final paragraph mark or not) and choose Insert > Quick Parts > Save Selection to Quick Part Gallery. You name the entry and set Type = Quick Parts, and Category = Vendor and make sure it is saved into the template that I posted.

Some background reading that will be useful to you is https://gregmaxey.com/word_tip_pages..._autotext.html and https://support.office.com/en-us/art...c-98599f16cadc
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Content Controls - Dependent Dropdown Dependent lists using content control SJPG Word VBA 4 01-05-2018 02:21 AM
Macro to save docx to doc that checks compatibility and converts content controls to static content. staicumihai Word VBA 4 10-12-2016 08:23 PM
Dropdown dependent text JakeLRL Word VBA 7 04-07-2016 08:26 AM
make text form field active dependent on dropdown Glenn0004 Word VBA 1 06-23-2015 06:13 PM
Word drop-down content control dependent display issue vvcat Word 6 02-03-2015 11:20 PM


All times are GMT -7. The time now is 07:12 AM.


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