Consulting

Results 1 to 4 of 4

Thread: Completely lost

  1. #1

    Completely lost

    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?

  2. #2
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    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.
    Greg

    Visit my website: http://gregmaxey.com

  3. #3
    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.




  4. #4
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    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
    Greg

    Visit my website: http://gregmaxey.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •