Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 09-21-2018, 08:26 PM
macropod's Avatar
macropod macropod is offline Drop down options in Column A, populates column B Windows 7 64bit Drop down options in Column A, populates column B Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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


With the macro as originally coded, it works with only two particular content controls. Try the attached. With the macro used in this approach, you only need a content control in the first column of the table.
Attached Files
File Type: docm Content Controls - questions.docm (38.1 KB, 13 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #17  
Old 09-21-2018, 09:14 PM
benji8798 benji8798 is offline Drop down options in Column A, populates column B Windows 7 32bit Drop down options in Column A, populates column B Office 2010 32bit
Novice
Drop down options in Column A, populates column B
 
Join Date: Sep 2018
Posts: 10
benji8798 is on a distinguished road
Default

hi

I can't get the values to pop up - I can populate them, but they are not showing up in my document. I attached a document with my example. How do I get the values to show in the document?

i'm not an expert by any means, so this is an easier way for me to use the function.
Reply With Quote
  #18  
Old 09-21-2018, 09:35 PM
macropod's Avatar
macropod macropod is offline Drop down options in Column A, populates column B Windows 7 64bit Drop down options in Column A, populates column B Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Look at the example document attached to my previous reply...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #19  
Old 09-21-2018, 09:43 PM
benji8798 benji8798 is offline Drop down options in Column A, populates column B Windows 7 32bit Drop down options in Column A, populates column B Office 2010 32bit
Novice
Drop down options in Column A, populates column B
 
Join Date: Sep 2018
Posts: 10
benji8798 is on a distinguished road
Default

Thank you. I have it working. Are you able to tell me what I was doing wrong, ie the answer not coming up in the second column, so I can apply this method to the proposal document?
Reply With Quote
  #20  
Old 09-21-2018, 09:47 PM
macropod's Avatar
macropod macropod is offline Drop down options in Column A, populates column B Windows 7 64bit Drop down options in Column A, populates column B Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Did you look at both the table structure (no content control in column 2) and the VBA code (which writes directly to column 2)?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #21  
Old 09-21-2018, 10:01 PM
benji8798 benji8798 is offline Drop down options in Column A, populates column B Windows 7 32bit Drop down options in Column A, populates column B Office 2010 32bit
Novice
Drop down options in Column A, populates column B
 
Join Date: Sep 2018
Posts: 10
benji8798 is on a distinguished road
Default

I have, but I'm so new to VBA that I do not understand it at all.
Reply With Quote
  #22  
Old 09-21-2018, 11:25 PM
gmayor's Avatar
gmayor gmayor is offline Drop down options in Column A, populates column B Windows 10 Drop down options in Column A, populates column B Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You have to actually leave the content control in order for the process below to fire. That means making a selection and clicking outside the control.

Paul's code is explained as follows:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Dim i As Long    'declare a long variable for use as a counter
With CCtrl    'The content control you are leaving
'check if the content control is in a table. If not quit the process
        If .Range.Information(wdWithInTable) = False Then Exit Sub
        'Ensure only content controls in the first column are processed
        If .Range.Cells(1).ColumnIndex > 1 Then Exit Sub
        'Process each content control list entry
        For i = 1 To .DropdownListEntries.Count
            'Establish which selection is made
            If .DropdownListEntries(i).Text = .Range.Text Then
                'Put the value associated with that selection in the cell to the right of the one with the control
                .Range.Cells(1).Range.Next.Cells(1).Range.Text = .DropdownListEntries(i).Value
                'and stop processing
                Exit For
            End If
        Next
    End With
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #23  
Old 09-21-2018, 11:38 PM
macropod's Avatar
macropod macropod is offline Drop down options in Column A, populates column B Windows 7 64bit Drop down options in Column A, populates column B Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Quote:
Originally Posted by benji8798 View Post
Are you able to tell me what I was doing wrong, ie the answer not coming up in the second column, so I can apply this method to the proposal document?
Quote:
Originally Posted by gmayor View Post
You have to actually leave the content control in order for the process below to fire. That means making a selection and clicking outside the control.
which is essentially what I said in post #7:
Quote:
Originally Posted by macropod View Post
Did you select a colour then exit the content control?
Given the response in post #8:
Quote:
Originally Posted by benji8798 View Post
Wow ! That is exactly what I am looking for !
it didn't occur to me I'd have to repeat that advice.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #24  
Old 09-22-2018, 07:51 AM
gmayor's Avatar
gmayor gmayor is offline Drop down options in Column A, populates column B Windows 10 Drop down options in Column A, populates column B Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Quote:
Originally Posted by gmayor View Post

https://www.gmayor.com/insert_content_control_addin.htm may be useful to you, though it does not allow the editing of Values. I may put that in a future version, but as it was written primarily to expedite work for a private client, it is not high on my todo list.
I decided to put this at the top of my todo list after all and have now updated the add-in to make it simpler to add list entries that have different values from the display name texts. Existing list and combo box controls may also be edited to include such different Value texts where they are not already present.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop down selection which influences value in an adjacent column lyndap2 Excel 1 08-06-2018 12:08 PM
Formula to check combinations of values in one column to find match from another column kong1802 Excel 1 06-15-2018 05:26 AM
Drop down list to overlay column of cells with different formulae TomJ Excel 0 12-19-2015 08:55 AM
How can I temporarily break a 3 column format in order to type a single column paragraph William P Word 1 01-04-2015 06:40 PM
drop down menu that control filter on other column massi Excel 0 08-24-2010 01:13 PM

Other Forums: Access Forums

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