#91
|
||||
|
||||
This thread concerns the use of content controls, not formfields, and you should not use content controls and formfields in the same document; they weren't designed to work that way and trying to do so can lead to inconsistent behaviour.
For formfields, see: https://www.msofficeforums.com/word/...html#post46429
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#92
|
|||
|
|||
Which would you recommend?
Thank you, I am looking at it now.
I am trying to create letters that can auto-fill multiple paragraphs per drop-down selection, and within these paragraphs, there are currently form fields. Is this even possible? |
#93
|
||||
|
||||
Definitely - and really no harder than having a single word as the conditional output.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#94
|
|||
|
|||
Preventing Edits
Macropod,
I have read through this entire thread and have not seen my issue addressed. I receive documents from multiple managers from across the country that I am trying to standardize. I have done this by enabling editing protections on the document itself and using text fields, a drop down list, and the date picker tool. When I select an option from my drop down list the appropriate field populates with the correct information. However, a person can go back to that output field and edit the information in that field. I have turned on editing restrictions to prevent this from happening, but that causes the code that you attached at the beginning of this thread to malfunction and not work. I want the users of this file to only be able to edit a few places and the drop down list output is not one of them. Any help is greatly appreciated. P.S. If you know how to restrict manual entry on the date picker and force the user to click the arrow to choose a date that would also be helpful. Thank you |
#95
|
||||
|
||||
You could use code like:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean) Dim i As Long, StrDetails As String With ContentControl If .Title = "Client" Then If .LockContents = True Then Exit Sub 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 With ActiveDocument.ContentControls(2) If .LockContents = True Then Exit Sub .Range.Text = StrDetails .LockContents = True End With .LockContents = True End If End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#96
|
|||
|
|||
Thank you for your response.
When I copy the code into my document with the previous code still in it, I get an error about an ambiguous name. If I delete the previous code and copy/paste the code you just provided into my document, when I select an item from the drop down menu the second content control never populates and just stays blank, I have tried fooling around with the code for a while and was unable to obtain the desired result. Any guidance is greatly appreciated. Also, did you have any insight into how to force the user to use the date picker tool while disabling manual entry? Thanks |
#97
|
||||
|
||||
Quote:
That's not possible. What you can do, however, is validate whatever has been input - both as a date and as to the date format.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#98
|
|||
|
|||
Where would I find the number of my content control? I applied the code however the other box is not populating.
I suspect that the reference is incorrect I am getting no errors. That leads to a question on how the connect controls behave when inserted. Does the new one no matter where inserted on document become the highest number or are they numbered from beginning to the end? Thank you for your input, I would give my age if I provided version and program that I used the last time I attempted VB. I found the content controls a welcome addition to word, (even more welcome when I figure out how to make them behave). |
#99
|
||||
|
||||
The # is the relative position in the document. An alternative is to give the output control a tag or title and reference it via that. See, for example, post #71 in this thread: https://www.msofficeforums.com/word-...tml#post120392
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#100
|
|||
|
|||
Thank you
I found my error, before I can delete the multiple outputs. I needed to modify the selection values and pipes.
I had named my boxes, for ease of use however, I am now updating to remove spaces (again for ease of use). May I ask a follow-up question? What is the best method to apply the same functionality to multiple sets of controls within the same document? Last edited by VGW; 07-10-2018 at 10:48 AM. |
#101
|
||||
|
||||
That depends. I suggest you start a new thread for that.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#102
|
|||
|
|||
Quote:
We have a form where we want the following: If "To be processed" is selected in the dropdown list it should on a line below give information "We are including X amount of attachments" where X need to be a textbox. Since this all is in a form. Is this possible? Many thanks Tanja Last edited by tostrand; 07-12-2018 at 08:07 AM. Reason: Enter my name |
#103
|
||||
|
||||
It works exactly the same with Word 2016. Without actually seeing your document, it can be difficult for anyone to diagnose the issue. Can you attach the document to a post (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#104
|
|||
|
|||
Hi Paul
Thank you for your quick reply. Attached is the document and it is all in swedish so let me know if that is an issue and I will translate it. When you open the document you will have a bold line saying "Vi bifogar samtliga handlingar – antal sidor sidor." This is the information I want to see more or less when selecting "för handläggning" in the dropdown menu. |
#105
|
||||
|
||||
Your document uses formfields, not content controls. The two are entirely different, so it's not surprising your not getting the desired results. For formfields, see: https://www.msofficeforums.com/word/...html#post46429
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Delete Multiple Entries | dudeabides | Office | 1 | 07-04-2011 02:49 AM |
Multiple task lists and multiple calendars | kballing | Outlook | 0 | 01-18-2011 10:23 AM |
Creating Multiple Contact Lists | meltee78 | Outlook | 1 | 01-03-2011 09:45 PM |
multiple calendar entries across a group | halfhearted | Outlook | 0 | 10-11-2009 12:13 PM |
Word Forms : Dropdown lists | wferaera45 | Word | 0 | 04-06-2006 03:02 AM |