Mailmerge with OLE
- How-to
- Pierre Couvreur
- PowerBuilder
- Thursday, 9 September 2021 02:30 PM UTC
Hello,
After a mailmerge with a document containing INCLUDEPICTURE fields, it is necessary to refresh the document by pressing F9 in Word.
To avoid that, I coded "lole_doc.Fields.Update" after the mailmerge.execute in my Powerscript mailmerge function. It works BUT only on the first story.
To make the update on each story, I would like to mimic that VBA macro in Powerscript :
Sub UpdateAllFieldsInDocument()
Dim rngStory As Range
'Iterate through all stories and update fields
For Each rngStory In ActiveDocument.StoryRanges
If Not rngStory Is Nothing Then
'Update fields directly in story
rngStory.Fields.Update
End If
Next rngStory
End Sub
Unfortunately I don't know how to replic that loop on each story.
Does someone know that ?
Thank you very much by advance !
Pierre.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.