• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: mailmerge word document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >mailmerge word document (From: Giampiero Cairo <email@hidden>)

  • Prev by Date: Re: TechNote 2106
  • Next by Date: Re: Deleting files
  • Previous by thread: mailmerge word document
  • Next by thread: Re: applescript-users digest, Vol 3 #2492 - 18 msgs
  • Index(es):
    • Date
    • Thread