![]() |
|
|
|
#1
|
|||
|
|||
|
Hi Paul, I am new to macros as well, and am looking for a solution to my problem without avail. I tried your zipped file, and understood how it work, but I need something more complex.
My document has a drop down list called 'Test Code.' Drop down options are 1,2,3...10 I want to make it such that whichever option is chosen, fields across the document are automatically filled in based on the option. For illustration, these fields are 'Test Objective', 'Test Conditions', etc. which are not successive fields, but are in different places. How do I implement this? Thanks |
|
#2
|
||||
|
||||
|
See post #33: https://www.msofficeforums.com/word-...html#post90264
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Hey Paul,
I looked back to #9 and #19, and didn't quite understand what you were trying to say. I tried messing around with the code based on what I thought was trying to be said, but failed to implement it without getting error codes every time. I have attached my template. Best, Vik |
|
#4
|
||||
|
||||
|
Since a docx file can't contain any macros and neither your post nor your document says what you're trying to achieve, I'm not in a position to advise.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#5
|
|||
|
|||
|
Sorry for the confusion. I messed up when removing the sensitive details and uploading. Here, I have attached it again.
What I'm trying to do is that when the Test Number is selected, I want the Description, Reason, and Objective to be filled in. I have filled these in to the values of the drop down list using '|', but I'm not able to have it print separately in different boxes. Thanks |
|
#6
|
||||
|
||||
|
See attached.
Note: Unless you want spaces either side of your Description, Reason, and Objective outputs, you shouldn't have them in the TestNo control's values. A generic version of the code is: Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim i As Long, StrDetails As String
With ContentControl
If .Title = "Client" Then
For i = 1 To .DropdownListEntries.Count
If .DropdownListEntries(i).Text = .Range.Text Then
StrDetails = .DropdownListEntries(i).Value
Exit For
End If
Next
If StrDetails = "" Then StrDetails = "||"
With ActiveDocument.SelectContentControlsByTitle("Output1")(1)
.LockContents = False
.Range.Text = Split(StrDetails, "|")(0)
.LockContents = True
End With
With ActiveDocument.SelectContentControlsByTitle("Output2")(1)
.LockContents = False
.Range.Text = Split(StrDetails, "|")(1)
.LockContents = True
End With
With ActiveDocument.SelectContentControlsByTitle("Output3")(1)
.LockContents = False
.Range.Text = Split(StrDetails, "|")(2)
.LockContents = True
End With
End If
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#7
|
|||
|
|||
|
Thanks a lot for your help!
The spaces on the sides were just a holdover from the description I had previously, thanks for pointing it out. |
|
#8
|
||||
|
||||
|
The ContentControlOnExit macro is missing from your document. If the updates are working correctly on your system without it, that suggests you've added the ContentControlOnExit macro to the document's template on your system instead of to the document itself.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#9
|
|||
|
|||
|
Yep - not sure how that happened but it's fixed and working now! Thank you!
|
|
#10
|
||||
|
||||
|
Perhaps it's an updated template you should have been distributing?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#11
|
|||
|
|||
|
***Disregard, I see it previously was discussed. Thanks so much***
Dear Paul, I hope you still check this from time to time. I am curious if I would have to change any of the Macro to get this to work in an existing table? Happy to give more details if you need them. Thanks |
|
#12
|
||||
|
||||
|
Did you try the demo in post #2 (https://www.msofficeforums.com/word-...html#post46903). If so, what doesn't that do that you want done?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#13
|
|||
|
|||
|
Don't think its the Macro, it's the Operator having the issue, and too many hours trying to resolve it myself. but I have that file saved, going to attempt it again tomorrow after I get some food and sleep and stop stressing over it.
|
|
#14
|
||||
|
||||
|
Cross-posted at: https://answers.microsoft.com/en-us/...b-6b6db6bc9336
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#15
|
|||
|
|||
|
Well I still don't understand how to get this to work.
I guess I am a "lead me by the hand" type of person. Not thick or stupid, I just don't understand the "why" or "how" part I guess, or even the basics of it all. Let me ask you this question. If I did succeed it getting this to work, I would have to save it as a ".doxm" correct? Would the person(s) wanting to use this form also have to have the macro installed and have to run it every time they fill in the info, or would it be automatic? Please understand, the less clicks and fiddling around to get the form filled out and printed with the info the better. Thanks again for the help. Beth |
|
|
|
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 |