Word Programmatic

J

Jeffrey Hodgson

1) I currently have an Access Database with a table (Table1) defined.
2) I have a field (Doc) defined in the table which is an OLE Object.
3) I can paste into the field a selection from a Word Document (Doc1 say)
which includes tables, diagrams etc and the field shows a Microsoft Word
Document.
4) I can copy this Microsoft Word Document field entry and paste it into
a Word Document whererupon I have to right click it and select
Document Object - Open. I then have the original selection from Doc1
in another Word Document.
5) I want to do this programmatically.
6) I have in VB

' Open a Word Document

Set objWord = New Word.Application

With objWord
.WindowState = wdWindowStateNormal
.Visible = True
.Documents.Add ("Normal.Dot")
End With

Set TheWordDocument = objWord.Documents.Item(1)

' Now get the data

Set ThisDatabase = DBEngine.Workspaces(0).Databases(0)
Set Inset = New Recordset
Set Inset = ThisDatabase.OpenRecordset("Table1")

Inset.MoveFirst

TheWordDocument.Range = Inset![Doc]

The last line executes but I get rubbish in the Word
document.

Any suggestions ?
 
Top