Hello! Do you have a question about Windows Server or Windows Client for IT Pros?
Please note that both categories together with questions have been moved to Microsoft Q&A. This change will help us provide a more streamlined and efficient experience for all your questions and discussions.
Hello! Do you have a question about Windows Server or Windows Client for IT Pros?
Please note that both categories together with questions have been moved to Microsoft Q&A. This change will help us provide a more streamlined and efficient experience for all your questions and discussions.
Need drop down options to insert different paragraphs within document
Hi,
I know how to insert a drop down. However, I need the options within the dropdown to trigger/insert specific paragraphs withint the microsoft word document. Could someone please help me, thanks!
That is what will happen. However, I would suggest that when creating the AutoText Entries, you DO create a new Category to use for each of the AutoText Entries that you create so that you can restrict the items that can be selected via the Building Block
Gallery Content Control to just those AutoText Entries that you want the user to be able to select.
If you define a new category, such as MyForm in the following example when you create the first AutoText Entry and then assign that category to the second one as well, then when you insert the Building Block Gallery Content Control and access its Properties,
select the AutoText Gallery and the MyForm Category as shown below.
Having done that, when you click on the Content Control drop down in the document, you will see
and when you choose an item OptionA or OptionB, (which were the names I used for the AutoText Entries), the Content Control will be populated with the contents of the selected option.
Hope this helps, Doug Robbins - MVP Office Apps & Services (Word) dougrobbinsmvp@gmail.com It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy
14 people found this reply helpful
·
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
See Doug's reply. However, if you must have a dropdown then without a whole lot of additional complicated code you will have to settle for the text to appear on the Exit from the CC. This is because CCs don't have a change event:
Lets assume that you have a template with two building blocks defined in the AutoText gallery/general category. The first is named P1 and the second named P2. In the template that contains the BBs, add this code to the "ThisDocument" module:
Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
Dim oTmp As Template
Set oTmp = ThisDocument.AttachedTemplate
Select Case CC.Title
Case "DDPars"
Select Case CC.Range.Text
Case "A"
CC.Type = wdContentControlText
oTmp.BuildingBlockTypes(wdTypeAutoText).Categories("General").BuildingBlocks("P1").Insert CC.Range
CC.Type = wdContentControlDropdownList
Case "B"
CC.Type = wdContentControlText
oTmp.BuildingBlockTypes(wdTypeAutoText).Categories("General").BuildingBlocks("P2").Insert CC.Range
CC.Type = wdContentControlDropdownList
Case Else
End Select
End Select
End Sub
In the document add a dropdown CC with two list entries "A" and "B". Title it DDPars
Greg Maxey *** Death smiles at us all, but all a man can do is smile back.
For more help with Word visit: http://gregmaxey.com/word_tips.html
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.