OLE Mail Merge (OpenInsight 32-Bit)
At 01 JUN 2007 11:15:04AM Colin Kavanagh wrote:
Anybody know how to return a list of MailMerge Fields from word.
Normally I would loop through the Fields collection in VB/VBA and interrogate the code property.
How can I access each individual field object via OI OLE.
Any help greatly appreciated
At 01 JUN 2007 12:22PM Bob Carten wrote:
There is an excellent article in Sprezzatura's SENL titled An Introduction to the Use of OLE controls from OpenEngine - Part 2 describing how to work with OLE automation and word.
The basic trick with collections such as fields is to get a reference the collection, get the count property, then for i=1 to count, get the item property. The Item property is zero based, so you have to keep that in mind.
something like
collection=OleGetProperty(MainObject, 'CollectionName')
cnt=OleGetProperty(collection, 'Count')
for i=1 to cnt
element=OleGetProperty(collection, 'Item', i-1)Name')Next
see This example of wlaking through the Bookmarks collection
At 01 JUN 2007 01:09PM Colin Kavanagh wrote:
Cheers, thanks