[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 635
  • Last Modified:

Access Import Data from Word 2007 Combo Box

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
    rst.AddNew
    x = 1
    Do Until x = rst.Fields.Count
        rst.Fields(x).Value = wrdApp.ActiveDocument.FormFields(rst.Fields(x).Name).result
        x = x + 1
    Loop
    rst.Update
    rst.Save
    rst.Close

Open in new window

0
Michael Vasilevsky
Asked:
Michael Vasilevsky
  • 2
1 Solution
 
geneusCommented:
For x = 1 To ActiveDocument.ContentControls.Count
   
   If ActiveDocument.ContentControls(x).Type = 3 Then
     ActiveDocument.ContentControls(x).Range.Select
   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

0
 
Michael VasilevskySolutions ArchitectAuthor Commented:
Huh?
0
 
Michael VasilevskySolutions ArchitectAuthor Commented:
I'm going with "no"
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now