Re: mailmerge word document
Re: mailmerge word document
- Subject: Re: mailmerge word document
- From: David Wignall <email@hidden>
- Date: Fri, 05 Mar 2004 22:00:30 +1300
on 4/03/2004 11:01 PM, Giampiero Cairo at email@hidden wrote:
>
Hi All,
>
I have a mailmerge word document with some merge fields.
>
How can I count the number of these fields and
>
get the name of these fields using Apple Script?
You can't in AppleScript, directly. These objects are not exposed in
AppleScript but they are in VBA and AppleScript has 'do Visual Basic.' So,
you could have a line like
do Visual Basic "Msgbox ActiveDocument.MailMerge.Fields.Count"
but if you need to use that value in your script then passing it back is an
issue. It may be better to have an entire VBA solution.
As to the second part of your question: if you are talking about your merge
document and not the data source document then the fields do not have names.
You can however read the codes:
do Visual Basic "
Dim fld As MailMergeField
For Each fld In ActiveDocument.MailMerge.Fields
MsgBox fld.Code
Next fld"
If, on the other hand, you are talking about the data source then it's
do Visual Basic "
Dim fld As MailMergeDataField
For Each fld In ActiveDocument.MailMerge.DataSource.DataFields
MsgBox fld.Name
Next fld"
--
hth
Dave
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.