Microsoft KB Archive/33065

-

{| 2.x 3.00 4.00 4.00a 5.00 | 2.20 2.21 3.00 WINDOWS                 | OS/2
 * width="100%"|

The information in this article applies to:
 * Microsoft Excel for Windows, version 2.x, 3.0, 4.0, 4.0a, 5.0
 * Microsoft Excel for OS/2 versions 2.2, 2,21, 3.0

SUMMARY
The following article explains how to use the REQUEST command from a Microsoft Excel macro with the topic of &quot;system.&quot; The REQUEST command is supported only with a full version of Microsoft Windows operating system, version 2.03 or later and the OS/2 Presentation Manager (PM).

The sample macro below executes another copy of Microsoft Excel, initiates a DDE (dynamic data exchange) channel to that copy of Microsoft Excel with the topic of &quot;system,&quot; and uses the REQUEST command for system information. To understand this article, you should be familiar with the following information (page numbers refer to the &quot;Microsoft Excel Function Reference,&quot; version 3.0).


 * Constructing a command macro
 * The EXEC macro command, page 70
 * The INITIATE macro command, pages 130-131
 * The REQUEST macro command, pages 197- 198
 * The TERMINATE macro command, page 234
 * The INDEX macro command, pages 127-129
 * The text concatenation operator &

MORE INFORMATION
This example assumes that a second copy of Microsoft Excel is being used as the used as the second application for the DDE link.

The macro is as follows (starting in cell A2 of the macro sheet):

A2: =EXEC(&quot;excel&quot;) A3: =INITIATE(&quot;excel&quot;&A2,&quot;system&quot;) A4: =INDEX(REQUEST(A3,&quot;SysItems&quot;),3) A5: =TERMINATE(A3) A6: =RETURN After this macro is executed, the value &quot;Status&quot; is placed in cell A4 of the macro sheet. Please note that the system topic &quot;SysItems&quot; returns a list of available items in the &quot;System&quot; topic. Any item returned by &quot;SysItems&quot; can be used as a &quot;system&quot; item and thus could be used in the REQUEST function.

For Microsoft Excel, the list of available topics includes the following:


 * SysItems
 * Topics
 * Status
 * Formats
 * Selection

Any of these items are legal &quot;system&quot; topics for Microsoft Excel. In the above example, you could replace your request for &quot;SysItems&quot; with one for available Clipboard formats: =INDEX(REQUEST(A3,&quot;Formats&quot;),1) In this case, the value of &quot;Biff&quot; is returned. The INDEX function must be used because topics return a list of values. If the INDEX function is not used, only the first value of that returned list will be visible. If an INDEX request is made beyond the range of returned values, a #REF error is returned.