Ik heb het al voor elkaar met de volgende code.
Het probleem is nu dat het plaatje niet goed in word terecht komt. Iemand een idee hoe het wel moet.
[edit van dusty: code tags toegevoegd]
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim plaat As Variant
Set db = CurrentDb()
Set rs = db.OpenRecordset("Select plaatje from objecten")
If rs.RecordCount > 0 Then
Set plaat = rs(0)
End If
Dim objWord As Word.Application
'Start Microsoft Word.
Set objWord = CreateObject("Word.Application")
With objWord
' Make the application visible.
.Visible = True
' Open the document.
.Documents.Open ("c:\MCP\object.doc ")
' Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("titel").Select
.Selection.Text = (CStr("anton"))
.ActiveDocument.Bookmarks("titel2").Select
.Selection.Text = (CStr("marco"))
.ActiveDocument.Bookmarks "plaatje").Select '' dit werkt natuurlijk niet op deze manier.
.Selection.Text = (CStr(plaat))
.ActiveDocument.SaveAs "c:\MCP\test.doc"
.ActiveDocument.Close
End With
Exit Sub |
Het probleem is nu dat het plaatje niet goed in word terecht komt. Iemand een idee hoe het wel moet.
[edit van dusty: code tags toegevoegd]