Insert a Picture stored in the AccessDB into Word

V

vari

Hi
I have a Access-Database in which I store Text (in Memo filed) and
Pictures (WMF's) as OLEObject.
Now I create a Word document and want to insert each text and the
picture.
But I don't know how to insert the OLEObject (a picture) into the word
document.
Any help?

Thx


I have the following code (fragments of it)

Private Sub CmdRunWord_Click()
On Error GoTo Err_CmdRunWord_Click

Dim oApp As Object
Dim oDoc As Object
Dim oShape As Object 'Word.InlineShape
Dim dbs As Database
Dim rst As DAO.Recordset
Dim oPic As Object
Dim owPic As Object
Dim strTitle As String
Dim strText As String
Dim s As String

Set oApp = CreateObject("Word.Application")


Set dbs = CurrentDb
s = "SELECT * from southwind;"

Set rst = dbs.OpenRecordset(s)

oApp.Visible = True
Set oDoc = oApp.Documents.Open()
With oApp
While Not rst.EOF
strTitle = rst!Title
strText = rst!Desc
Set oPic = rst!OLEObjekt
rst.MoveNext
.Selection.TypeText Text:=strTitle
If Not IsNull(oPic) Then

Set oShape = oDoc.InlineShapes.AddOLEObject( _
ClassType:="Word.Picture", FileName _
:="", LinkToFile:=False, DisplayAsIcon:=False)

Set owPic = oShape.OLEFormat.Object
owPic = oPic
owPic.Activate


End If
.Selection.TypeParagraph
Wend
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top