Consulting

Results 1 to 3 of 3

Thread: Use Drop-Down List Content Control to Populate Bookmark (multiselect)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Dec 2022
    Posts
    1
    Location

    Use Drop-Down List Content Control to Populate Bookmark (multiselect)

    Hello,

    I have programmed in VBA for years but mostly in Excel. Right now, I am making a .DOTX or template file in Word and I have a Drop-Down List (content control style) and I am attempting to give users the ability to select items from the list and have the selections populate to preselected locations in the Word Document. Does that make sense?

    My main issue is that I have no working knowledge of the vba behind these "content controls" I just spent hours reading through literature about them but can't quite wrap my head around it. Below is my really bad attempt at what I am trying but should shed some light on where I am going with this. Basically, I would like the user to "activate" the drop down, click the item them want, and it will populate directly below (using a bookmark) in the word document. If they select another item, it will in some way populate with the first item or move on to the next line below the first entry.

    I know this is not great but I think it will guide a better understanding of what I am trying to accomplish. Hopefully it is possible and thanks in advance.

    Sub DDmulti()
    Dim doc As Word.Document
        Dim ccLB As Word.ContentControl
        Set doc = ActiveDocument
        Set ccLB = doc.SelectContentControlsByTitle("lb").Item(1)
    If ccLB.selected Then
     Selection.GoTo What:=wdGoToBookmark, Name:="lb"
      With Selection
     Selection.Add
     End With
    End If
    End Sub
    Last edited by Aussiebear; 12-02-2022 at 01:41 PM. Reason: Added code tags to supplied code

Tags for this Thread

Posting Permissions

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