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?
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

Signature
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
>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
[quoted text clipped - 5 lines]
> 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?
hubbie - 22 Aug 2006 14:51 GMT
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
> 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
[quoted text clipped - 14 lines]
> > 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?
Peter Jamieson - 22 Aug 2006 15:34 GMT
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
> The print preview doesn't seem to do the trick. I still have to select
> all
[quoted text clipped - 42 lines]
>> > pictures.
>> > Can I include this in my code somehow?