Access Import Data from Word 2007 Combo Box

Posted on 2009-04-23
Last Modified: 2013-11-27
I'm using code like the below to import data from a Word 2007 document to my Access database. Is there similar code to extract data from Combobox controls on the Word document that are NOT form fields?

rst.Open "tbl_TEMPData", CurrentProject.Connection, adOpenStatic, adLockPessimistic


    x = 1

    Do Until x = rst.Fields.Count

        rst.Fields(x).Value = wrdApp.ActiveDocument.FormFields(rst.Fields(x).Name).result

        x = x + 1





Open in new window

Question by:Michael Vasilevsky
    LVL 12

    Expert Comment

    For x = 1 To ActiveDocument.ContentControls.Count
       If ActiveDocument.ContentControls(x).Type = 3 Then
       End If
       MsgBox "Found ComboBox"
    Next x
    Dim objCC As ContentControl
    Dim objRange as Range
    Set objRange = ActiveDocument.Range(200, 200)
    Set objCC = objRange.ContentControls.Add(wdContentControlDropdownList)
    'List entries
    objCC.DropdownListEntries.Add "Cat"
    objCC.DropdownListEntries.Add "Dog"
    objCC.DropdownListEntries.Add "Horse"
    objCC.DropdownListEntries.Add "Monkey"
    objCC.DropdownListEntries.Add "Snake"
    objCC.DropdownListEntries.Add "Other"

    Open in new window

    LVL 10

    Author Comment

    by:Michael Vasilevsky
    LVL 10

    Accepted Solution

    I'm going with "no"

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
    What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now