G
Guest
Hello,
I am using Access 2003 with ADO. I have created a
template of a meeting invitation in MS Word with
bookmarks. From Access, I want to open the template,
save it to another .doc document and add the fields from
the Access form to the Word document. I am able to open
Word. What seems to be happening is that Word is
creating a new document but not based on the template.
Therefore, I get an error stating the bookmark is not
found. Below is a sample of the code:
Dim DPDDoc As Document
Dim WordAppl As Word.Application
Dim ClientFirst, ClientLast, Loc, Phone, Time As String
Dim MeetingDate As Date
Set WordAppl = New Word.Application
WordAppl.Visible = True
WordAppl.Documents.Open "C:\MeetingInvitation.dot"
WordAppl.Documents.Add
ClientFirst = Forms!MeetingForm!FirstName
ClientLast = Forms!MeetingForm!LastName
Loc = Forms!MeetingForm!MeetingLoc
Time = Forms!MeetingForm!MeetingTime
With WordAppl.ActiveDocument.Bookmarks
.Item("First").Range.Text = ClientFirst
.Item("Location").Range.Text = Loc
End With
Does anyone have any idea of what I am doing wrong?
Thanks so much in advance.
Debbie
I am using Access 2003 with ADO. I have created a
template of a meeting invitation in MS Word with
bookmarks. From Access, I want to open the template,
save it to another .doc document and add the fields from
the Access form to the Word document. I am able to open
Word. What seems to be happening is that Word is
creating a new document but not based on the template.
Therefore, I get an error stating the bookmark is not
found. Below is a sample of the code:
Dim DPDDoc As Document
Dim WordAppl As Word.Application
Dim ClientFirst, ClientLast, Loc, Phone, Time As String
Dim MeetingDate As Date
Set WordAppl = New Word.Application
WordAppl.Visible = True
WordAppl.Documents.Open "C:\MeetingInvitation.dot"
WordAppl.Documents.Add
ClientFirst = Forms!MeetingForm!FirstName
ClientLast = Forms!MeetingForm!LastName
Loc = Forms!MeetingForm!MeetingLoc
Time = Forms!MeetingForm!MeetingTime
With WordAppl.ActiveDocument.Bookmarks
.Item("First").Range.Text = ClientFirst
.Item("Location").Range.Text = Loc
End With
Does anyone have any idea of what I am doing wrong?
Thanks so much in advance.
Debbie