PDA

View Full Version : Completely lost



TheEdge883
03-13-2018, 11:26 AM
I'm not even sure where to start. I've been tasked at work to create a template letter, and modify the letter to allow a user to select from a list of paragraphs, more than one in some situations.

I've found that the easiest way to do this is to add a drop down selection box, if someone selects the paragraph title, it will add that paragraph to the document, and allow if needs be, to add a second or third.

After goofing with this thing since this morning, I realize that the only real way to do this in this work environment is by writing specific VBA code to add the paragraph on the condition of the paragraph selection. Problem is, I have no idea where to begin, and our office coder isn't answering me.

Any ideas?

gmaxey
03-13-2018, 02:52 PM
If you have a dropdown selection box working as described in your paragraph 2 then apparently you have already begun. I don't see how you could have done that without writing some code. Where is it?

Where are these paragraphs which you have listed located?

You are going to have to provide a lot more detail.

TheEdge883
03-13-2018, 04:16 PM
Apologies if myprior post was not clear.

The option to add a pull-down menu to my document was just a selection under Developer > Controls. I just selected the Drop-Down List content control. When I did that, I accessed Properties for that list, and added the selections I needed, which is just a little blurb describing the paragraph I want to use.

I guess I was looking for something to try to auto populate a paragraph once I make that selection.


I’ve looked into adding the paragraphs as quick parts, but in order to make this document useable from each computer that it will be using the document, I need to beable to transer the .dotm file into a directory on their computers that we do not have access to.

So I was hoping to be able to create some VBA code to do the auto populate that we need. If it’s not possible, I’ll try and jimmy something up with excel.

gmaxey
03-14-2018, 04:16 AM
Your present is no clearer than your first. Do you really want a dropdown list of blurbs in your finished document? Where do these paragraphs go if you select one of them?

If the answer to the first question is yes then you could start with the CC OnExit event in the ThisDocument module:

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Select Case ContentControl.Title
Case "List of Ps"
Select Case ContentControl.Range.Text
Case "Blurb about A"
ActiveDocument.Range.InsertAfter "Some blah, blah about the letter A"
Case "Blurb about B"
ActiveDocument.Range.InsertAfter "Some blah, blah about the letter BA"
End Select
End Select
End Sub