#16
|
||||
|
||||
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.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#17
|
|||
|
|||
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. |
#18
|
||||
|
||||
Look at the example document attached to my previous reply...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#19
|
|||
|
|||
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?
|
#20
|
||||
|
||||
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] |
#21
|
|||
|
|||
I have, but I'm so new to VBA that I do not understand it at all.
|
#22
|
||||
|
||||
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 |
#23
|
||||
|
||||
Quote:
Quote:
Given the response in post #8: it didn't occur to me I'd have to repeat that advice.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#24
|
||||
|
||||
Quote:
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
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 |