Microsoft Word Suite
237
This example counts the number of LISTNUM fields in the variable
myRange
. The result is displayed
in a message box.
set myDoc to active document
set myRange to create range myDoc start (start of content of text object of ¬
paragraph 12 of myDoc) end (end of content of text object of ¬
paragraph 20 of myDoc)
set numfields to count numbered items list format of myRange number type ¬
number
listnum
display dialog numfields
Command: create data source
Creates a Word document that uses a table to store data for a data merge. The new data source is
attached to the specified document, which becomes a main document if it's not one already.
Syntax
create data source data merge Required. An expression that returns a data merge object.
[name Unicode text] Optional. The path and file name for the new data source.
[password document Unicode text] Optional. The password required to open the new data
source.
[write password Unicode text] Optional. The password required to save changes to the data
source.
[header record Unicode text] Optional. Field names for the header record. If this argument is
omitted, the standard header record is used: Title, FirstName, LastName, JobTitle, Company,
Address1, Address2, City, State, PostalCode, Country, HomePhone, WorkPhone.
[MS Query Boolean] Optional. True to launch Microsoft Query, if its installed. The name,
password document, and header record arguments are ignored.
[SQL statement Unicode text] Optional. Defines query options for retrieving data.
[SQL statement1 Unicode text] Optional. If the query string is longer than 255 characters, SQL
statement specifies the first portion of the string, and SQL statement1 specifies the second
portion.
[connection Unicode text] Optional. When retrieving data through ODBC, the connection string
that specifies the database within which the query specified by SQL statement will be
performed.
[link to source Boolean] Optional. True to perform the query specified by connection and SQL
statement each time the main document is opened.