cannot update locked fields

H

hubbie

I using an excel db and trying to perform an auto mail merge. The merge
seems to be working but I get an error that reads "Word found locked fields
during the update. Word cannot update locked fields." All my fields seem to
be updated but I want to get ride of this error??
Also, part of my db is a link to a jpg for each merged page. After the
merge I am required to do a Ctrl-A and F9 to update and see the pictures.
Can I include this in my code somehow?
 
D

Doug Robbins - Word MVP

I don't know what is causing the locked field error message, but you can
include code to update the fields. The quickest way is to use the command
to do a print preview and then close the print preview

With ActiveDocument
.PrintPreview
.ClosePrintPreview
End With

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
H

hubbie

The print preview doesn't seem to do the trick. I still have to select all
and F9 to bring in the jpg. Any other suggestions? Thanks!! here's the
code...

Option Explicit
Private Sub Document_Open()
DoMailMerge
End Sub
Public Sub DoMailMerge()
Dim DocName$
DocName = ActiveDocument.Name
'Do mailmerge
With ActiveDocument.mailmerge
.Destination = wdSendToNewDocument
.Execute
End With
With ActiveDocument
.PrintPreview
.ClosePrintPreview
End With
'Close mailmerge document
Windows(DocName).Close wdDoNotSaveChanges
End Sub
 
P

Peter Jamieson

You should be able to update all the fields in the /body/ using

ActiveDocument.Content.Fields.Update

One of the reasons you can get a locked field message is because of the way
you inserted the original image in your mail merge main document. There is
an article about it at

http://support.microsoft.com/kb/292155

Peter Jamieson
 

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