How to Use Variables in a DDEExecute() CommandLast reviewed: April 29, 1996Article ID: Q96351 |
The information in this article applies to:
SUMMARYWhen you are using dynamic data exchange (DDE), variables used in the DDEExecute() command must be concatenated because all the characters between the single quotation marks are sent to the application for interpretation.
MORE INFORMATIONThe following command opens the spreadsheet TEST.XLS if Microsoft Excel is already open:
=DDEExecute(chan,'[Open("test.xls")]')However, the following DDEExecute() command will not work:
filename= "test.xls" =DDEExecute(chan,'[Open(filename)]')This command can be made to work by issuing the following DDEExecute() command:
=DDEExecute(chan,'[Open('+'"'+filename+'")]')The above command encloses the double quotation marks expected by Microsoft Excel in single quotation marks. Concatenation of the quotation marks must be done in the command itself since DDEExecute() is sending the entire string between the single quotation marks to Microsoft Excel. Another alternative is to concatenate the entire command before the DDEExecute() command, and use macro substitution as follows:
testname= "test.xls" ddecomm= "'[Open("+CHR(34)+"d:\excel4\"+testname+CHR(34)+")]'" =DDEExecute(chan,&ddecomm)NOTE: CHR(34) provides the double quotation marks required by the Microsoft Excel Open command.
|
Additional reference words: VFoxWin 3.00 FoxWin 2.50 2.50a quotes
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |