The code you posted is fairly common, bases on (or perhaps exactly) the
code from the Access 97 Developer's Handbook
(
http://www.developershandbook.com/) even if you didn't get it from
there.
The code does not actually "fill out" a word form, what it does is
_replace_ the form's bookmarks with the text from your application.
This means the code will fail if either your form doesn't have
bookmarks in it (most likely case) or you're using it to fill out a
previously filled out form.
moelleni wrote:[color=blue]
> Hi,
> I made an Access 2002 Database and wanted to automate it to sent the
> current record to Word 2002. So readed the article "How to send the
> current record to Word 2000 with automation" I tried to do this with my
> db.
> Here is my code:
>
> Private Sub MergeButton_Click()
> On Error GoTo MergeButton_Err
> Dim objWord As Word.Application
> 'Start Microsoft Word 97.
> Set objWord = CreateObject("Word.Application")
> With objWord
> 'Make the application visible.
> .Visible = True
> 'Open the document.
> .Documents.Open ("D:\Aullo\Réclamation_Test.doc")
> 'Move to each bookmark and insert text from the form.
> .ActiveDocument.Bookmarks("Matricule_E").Select
> .Selection.Text = (CStr(Forms!Réclmation!Matricule_E))
> .ActiveDocument.Bookmarks("Matricule_D").Select
> .Selection.Text = (CStr(Forms!Réclamation!Matricule_D))
> End With[/color]
<snip>[color=blue]
> Here is now my problem: It opens my word document but does not insert
> any objets. I don't understand why??
> Can anybody help my?[/color]