Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

compiling error on .ActiveDocument.Bookmarks

Status
Not open for further replies.

philippevans

IS-IT--Management
Nov 17, 2008
2
BE
Opening a Word Document and filling it with data from an Access Form : reffering to faq702-2379

this part is giving me a compiling error.

.ActiveDocument.Bookmarks("<bookmark name>".Select
.Selection.Text=(Cstr(Forms!<form name>!<field
name>))
.ActiveDocument.Bookmarks.Add Name:=<bookmark name>,

How can I solve this ?
 
How have you modified this to suit your application? Please post the code showing the names of bookmarks(s) that you are using in place of <bookmark name>.
 
.ActiveDocument.Bookmarks("naam").Select
.Selection.Text = (CStr(Forms!full_verzekeringsnemer!Naam))
.ActiveDocument.Bookmarks.Add Name:=Naam
.ActiveDocument.Bookmarks("naam").Select
.Selection.Text = (CStr(Forms!full_verzekeringsnemer!Naam))
.ActiveDocument.Bookmarks.Add Name:=Naam
 
There are a few problems here. The FAQ you mention is for filling in a number of bookmarks that you have already created in a Word document. It would typically be used for filling in name and address into a letter.

This line:
.ActiveDocument.Bookmarks.Add Name:=Naam

Would be used to create a new bookmark, which is beyond the scope of the FAQ, and at that, you would need a new name, for example:
.ActiveDocument.Bookmarks.Add Name:="AddressLine1"

There is one other point, the FAQ contains a little more coding than is needed. You can say:

Code:
.ActiveDocument.Bookmarks("AddressLine1").Range=CStr(Forms!full_verzekeringsnemer!Naam)

Does that help?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top