Hi Andrew,
There are multiple ways to use the ADO library for this. Killian's example uses SQL to retrieve the data.
I'm using a named range in Excel because that's another easy way to do this:
If I remember well you also use 2003 like me so I've made a little example for you witch has a reference to the ADO Library in this way we can test if you're library is working or not.
The code I'm using:[VBA]
Sub ExcelDataToBookmarks()
Dim cn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & ActiveDocument.Path & "\Test.xls;" & _
"Extended Properties=""Excel 8.0;HDR=Yes"""
Set rst = New ADODB.Recordset
rst.Open "DataWord", cn 'DataWord is Named range in Excel
With ActiveDocument
Do Until rst.EOF
.Bookmarks(CStr("" & rst.Fields(0))).Range.Text = CStr("" & rst.Fields(1))
rst.MoveNext
Loop
End With
rst.Close
cn.Close
Set rst = Nothing
Set cn = Nothing
End Sub
[/VBA]
Run the code in the attachment with ALT+F8
Enjoy!![]()