Connection Optional Variant A range within which the query specified by SQLStatement is to be performed. (See Remarks below.)
SQLStatement Optional Variant Defines query options for retrieving data. (See Remarks below.)
SQLStatement1 Optional Variant If the query string is longer than 255 characters, SQLStatement specifies the first portion of the string, and SQLStatement1 specifies the second portion. (See Remarks below.)
OpenExclusive Optional Variant True to open exclusively.
SubType Optional Variant Can be one of the WdMergeSubType constants.
Remarks
To determine the ODBC connection and query strings, set query options manually and use the QueryString property to return the connection string. The following table includes some commonly used SQL keywords.
Keyword Description
DSN The name of the ODBC data source
UID The user logon ID
PWD The user-specified password
DBQ The database file name
FIL The file type
To instruct Word to use the same connection method as in earlier versions of Word (Dynamic Data Exchange (DDE) for Microsoft Office Access and Microsoft Office Excel data sources) use
SubType:=wdMergeSubTypeWord2000
.
How you specify the range depends on how data is retrieved. For example:
When retrieving data through Open Database Connectivity (ODBC), you specify a connection string.
When retrieving data from Excel using dynamic data exchange (DDE), you specify a named range.
Security Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).
When retrieving data from Access, you specify the word "Table" or "Query" followed by the name of a table or query.
Partager