Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-24-2017, 10:44 PM
macropod's Avatar
macropod macropod is online now Edit table cells based on content control selection Windows 7 64bit Edit table cells based on content control selection Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
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

The original thread was: https://www.msofficeforums.com/word-...own-lists.html

Regarding my previous post, your 'Client' dropdown has only one meaningful item, so there's no real point in it being a dropdown, and your 'client details' content control isn't a dropdown either, so you can't choose from any of its 'Description, 'Manufacturer', 'Model', 'Serial No.', or Cal. Due' entries. Hence my comments re a lack of clarity.

But, yes, it is possible to modify the macro to populate a series of table cells. For example:


Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Dim i As Long, j As Long, StrDetails As String
With CCtrl
  If .Title = "Client" Then
  For i = 1 To .DropdownListEntries.Count
    If .DropdownListEntries(i).Text = .Range.Text Then
      StrDetails = .DropdownListEntries(i).Value
        For j = 0 To UBound(Split(StrDetails, "|"))
          .Range.Rows(1).Cells(j + 2).Range.Text = Split(StrDetails, "|")(j)
        Next
      Exit For
    End If
  Next
  End If
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 03-25-2017, 08:37 AM
gennatr12 gennatr12 is offline Edit table cells based on content control selection Windows 7 64bit Edit table cells based on content control selection Office 2016
Novice
Edit table cells based on content control selection
 
Join Date: Mar 2017
Posts: 4
gennatr12 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
The original thread was: https://www.msofficeforums.com/word-...own-lists.html

Regarding my previous post, your 'Client' dropdown has only one meaningful item, so there's no real point in it being a dropdown, and your 'client details' content control isn't a dropdown either, so you can't choose from any of its 'Description, 'Manufacturer', 'Model', 'Serial No.', or Cal. Due' entries. Hence my comments re a lack of clarity.

But, yes, it is possible to modify the macro to populate a series of table cells. For example:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Dim i As Long, j As Long, StrDetails As String
With CCtrl
  If .Title = "Client" Then
  For i = 1 To .DropdownListEntries.Count
    If .DropdownListEntries(i).Text = .Range.Text Then
      StrDetails = .DropdownListEntries(i).Value
        For j = 0 To UBound(Split(StrDetails, "|"))
          .Range.Rows(1).Cells(j + 2).Range.Text = Split(StrDetails, "|")(j)
        Next
      Exit For
    End If
  Next
  End If
End With
End Sub

I just wanted to thank you for helping me out. I was trying to figure out a way so that when you select an option from the drop-down list content control(the one under the 'Asset No.' column) it would fill out the remaining adjacent table cells. So in the attached document you can select an asset number from the drop-down list and it will populate the table cells with the corresponding data(description, manufacturer, model, serial, and calibration due). When it's all said and done the drop-down list will have a lot more options to choose from, but for now this was just an example for me to test everything out. I may have more questions later on, but for now this is exactly what I needed. Again, thank you so much for your help.
Attached Files
File Type: docm Equipment List - Copy.docm (30.2 KB, 16 views)
Reply With Quote
  #3  
Old 03-25-2017, 09:08 AM
gennatr12 gennatr12 is offline Edit table cells based on content control selection Windows 7 64bit Edit table cells based on content control selection Office 2016
Novice
Edit table cells based on content control selection
 
Join Date: Mar 2017
Posts: 4
gennatr12 is on a distinguished road
Default

And by later on, I mean I have a question now. So in your code you have this line:

If .Title = "Client" Then

How would I go about editing the code to allow more than one title name. For example I wanted to have one drop-down list with the title Client and a second(separate) drop-down list with the title Client1.

Thank you for your time and any help is greatly appreciated.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit table cells based on content control selection How do I add selection of multi line content control list to specific table cell Dudlee Word VBA 1 09-20-2016 04:58 PM
Edit table cells based on content control selection Edit table in content control denise do rocio maciel Word VBA 2 01-03-2016 11:59 PM
How-to: Add a quickpart, field or Building Block Gallery Content Control based on a UserForm HighSierra Word VBA 0 05-06-2015 08:20 PM
Combo Box Content Control Calculate on selection help ciresuark Word 0 03-06-2015 01:49 PM
Edit table cells based on content control selection Deleting a table from a content control -- preserving the content control BrainSlugs83 Word Tables 8 11-14-2013 03:06 AM

Other Forums: Access Forums

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