XL: How to Concatenate DDE to MSQuery StatementsLast reviewed: February 3, 1998Article ID: Q149248 |
The information in this article applies to:
SUMMARYIn Microsoft Query, to use concatenated variables, and to know where and how to break a line of code for Line Continuation, you need to know how dynamic data exchange (DDE) to Microsoft Query statements are formatted. This article provides an understanding of the rules governing manipulation of the DDE to Microsoft Query statements.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/default.aspFor example, consider the following line of DDE to Microsoft Query code:
DDEExecute Chan, "[UserControl('&Return to Excel',3)]"
In this example, note the following:
Concatenation Method 1: Leave the Apostrophes Within the Quotation Marks
Concatenation Method 2: Preserve the Apostrophes Within the VariableTo do this, perform the following steps:
Line Continuation ExampleWhen you "break" a DDE to Microsoft Query statement for Line Continuation, use the following steps:
Statement Formatting ExampleWhen you concatenate variables, the format of the data used must match that which is required by Microsoft Query. For example, when you return data to Microsoft Excel from Microsoft Query using DDE, you must address the worksheet range in which you want to place the requested data in the R1C1 reference style. This example shows how to format the variable "FetchLoc" in the R1C1 reference style, as required by Microsoft Query:
FetchLoc = fetchdata.Address(referenceStyle:=xlR1C1) _
& ":" & fetchdata.Offset(NumRows(1), _
NumCols(1)).Address(referenceStyle:=xlR1C1)
The variable "FetchLoc" can now be concatenated in the DDE to Microsoft
Query statement, as in the following example:
NOTE: Remember to retain the apostrophes.
DDEExecute Chan, ("[Fetch('Excel','Sheet1','" & _
FetchLoc & "','All/Headers')]")
|
Additional query words: 5.00 5.00a 5.00c 7.00 8.00 XL98 XL97 XL7 XL5
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |