Microsoft KB Archive/68203

{| = Using COMMAND to Send an Execute String to Q+E =
 * width="100%"|

Last reviewed: November 2, 1994

Article ID: Q68203

SUMMARY
Q+E versions 2.50 and 3.00 support the COMMAND function that allows you to construct large execute commands and send them to Q+E a portion at a time. This function exists because some macro languages, such as the Microsoft Excel macro language, have limits on the size of character variables.

MORE INFORMATION
The COMMAND function requires two arguments. The first argument, op_num, is a number from 1 to 3 that specifies how Q+E receives and handles the second argument, exec_string.

Note the following:


 * If op_num is 1: Q+E initializes a buffer and saves exec_string
 * If op_num is 2: Q+E adds the exec_string to the buffer
 * If op_num is 3: Q+E adds the exec_string and executes the buffer

exec_string is the string of commands executable by Q+E. The syntax for these commands is the same format that is used with the DDE EXECUTE function. Each command must be enclosed in square brackets and the entire string, including the square brackets, must be enclosed in quotation marks. The following example assumes that Q+E is listed correctly in the PATH statement and that the file ADDR.DBF is in the subdirectory C:\QE:

A1: chan=INITIATE(&quot;qe&quot;,&quot;system&quot;) A2: =EXECUTE(chan,&quot;[command(1,'[open(select * from ')]&quot;)   A3:  =EXECUTE(chan,&quot;[command(2,'dbasefile|')]&quot;)   A4:  =EXECUTE(chan,&quot;[command(3,'c:\qe\addr.dbf)]')]&quot;) A5: =RETURN The first line initializes the DDE channel. The second line causes Q+E to initialize a buffer and save the string &quot;'[open(select * from &quot;, without the double quotation marks. Note, there is a space between the word &quot;from&quot; and the single quotation mark. Also, the asterisk signifies bringing in all fields. The third line sends the string &quot;dbasefile|&quot; (without the quotation marks), which Q+E concatenates to the buffer. The fourth line sends the string &quot;c:\qe\addr.dbf)]'&quot;, without the double quotation marks, which Q+E concatenates to the buffer before executing the complete command buffer. The example above is equivalent to the following macro: A1: chan=INITIATE(&quot;qe&quot;,&quot;system&quot;) A2: =EXECUTE(chan,&quot;[open(select * from dbasefile|c:\qe\addr.dbf)]&quot;) A3: =RETURN
 * }