Populating Bookmark Fields

G

Gez

Hi,

I've got a protected word document that only allows users to populate text
form fields. I want to be able to populate some of these text form fields
from access but I'm getting "runtime error 6028 The Range Cannot be
Deleted". I'm using the code below, any ideas?

Private Sub PrintWithWord()

Dim objWord As Word.Application

Set objWord = New Word.Application
objWord.Documents.Add _
Application.CurrentProject.Path & "\test.doc"
objWord.Visible = True

With objWord.ActiveDocument.Bookmarks
.Item("text1").Range.Text = "Some data here"
End With

Set objWord = Nothing
End Sub

Thanks,

Gez
 
G

Gez

Resolved this now. Should have used :

With objWord.ActiveDocument
.FormFields("Text1").Result = "Some Data Here"
 

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