Excel: Using the REQUEST Macro Command for System Information

Last reviewed: July 25, 1995
Article ID: Q33065
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 "system." 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 "system," 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 "Microsoft Excel Function Reference," 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("excel")
   A3: =INITIATE("excel"&A2,"system")
   A4: =INDEX(REQUEST(A3,"SysItems"),3)
   A5: =TERMINATE(A3)
   A6: =RETURN()

After this macro is executed, the value "Status" is placed in cell A4 of the macro sheet.

Please note that the system topic "SysItems" returns a list of available items in the "System" topic. Any item returned by "SysItems" can be used as a "system" 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 "system" topics for Microsoft Excel. In the above example, you could replace your request for "SysItems" with one for available Clipboard formats:

   =INDEX(REQUEST(A3,"Formats"),1)

In this case, the value of "Biff" 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.

REFERENCES

"Microsoft Excel User's Guide 2," version 4.0, page 302 "Microsoft Excel User's Guide," version 3.0, page 343 "Microsoft Excel Reference," version 2.x, 265


KBCategory: kbother
KBSubcategory:

Additional reference words: 5.00 2.1 2.10 3.0 3.00 4.0 4.00


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 25, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.