Dear all,
Using VBA in Access to control mailmerge docs in Word. The mailmerge doc includes {IncludePicture} fields in both the main document body and the header, so that the datasource can supply paths to different images for different records. All the picture fields are in the form:
{IncludePicture "C:\\Some\\Path\\picture.gif" \d }
where "C:\\Some\\Path\\picture.gif" is data supplied by the datasource (mergefields).
My code opens the mailmerge doc in an instance of Word (objWord) and merges it to a new document, then closes the original mailmerge doc, leaving me with just the merged document (objWord.ActiveDocument).
My code then currently does the following:
With objWord
.ActiveDocument.Fields.Update
.ActiveDocument.PrintOut False, False, wdPrintAllDocument, , , , , 1, , , False, True
.ActiveDocument.Close wdDoNotSaveChanges
End With
The ...Fields.Update call successfully updates all the picture fields in the main body of the document, but doesn't update a picture field that sits nested in a text box in the header sections. I somehow need to select all these fields and force them to update, or parse through each header section, selecting each text box and update the picture fields one by one.
If anyone has any idea how to accomplish this...!!!
willpower
Using VBA in Access to control mailmerge docs in Word. The mailmerge doc includes {IncludePicture} fields in both the main document body and the header, so that the datasource can supply paths to different images for different records. All the picture fields are in the form:
{IncludePicture "C:\\Some\\Path\\picture.gif" \d }
where "C:\\Some\\Path\\picture.gif" is data supplied by the datasource (mergefields).
My code opens the mailmerge doc in an instance of Word (objWord) and merges it to a new document, then closes the original mailmerge doc, leaving me with just the merged document (objWord.ActiveDocument).
My code then currently does the following:
With objWord
.ActiveDocument.Fields.Update
.ActiveDocument.PrintOut False, False, wdPrintAllDocument, , , , , 1, , , False, True
.ActiveDocument.Close wdDoNotSaveChanges
End With
The ...Fields.Update call successfully updates all the picture fields in the main body of the document, but doesn't update a picture field that sits nested in a text box in the header sections. I somehow need to select all these fields and force them to update, or parse through each header section, selecting each text box and update the picture fields one by one.
If anyone has any idea how to accomplish this...!!!
willpower