Microsoft KB Archive/51089

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


Excel: Calling a Code Resource Using CALL/REGISTER Routines

Last reviewed: April 3, 1997
Article ID: Q51089

2.20 MACINTOSH The information in this article applies to:

  • Microsoft Excel for the Macintosh, version 2.2

SUMMARY

Microsoft Excel can call routines that have been compiled as code resources (sometimes referred to as dynamic link libraries, or DLLs).

Code resources are called from macros and operate much like function macros.

Before a resource can be called, it must first be registered to Microsoft Excel using the REGISTER command. The REGISTER command loads the code resource into memory and defines the parameters that the resource will accept and return.

REGISTER Command

The following is the format of the REGISTER command:

   REGISTER(file_name,resource_name,argument_types)

"file_name" is the name of the file containing the code resource. Microsoft Excel looks in the active directory for the file containing the code resource, unless a pathname is specified. "resource_name" is the name given to the code resource when it is compiled. You must always specify a resource name, even if there is only one code resource in the file.

"argument_types" is a text string specifying the argument type passed to Microsoft Excel and the argument types passed from Microsoft Excel to the code resource. Note that the first character specifies the argument passed from the resource to Microsoft Excel, and the subsequent characters specify the arguments passed from Microsoft Excel to the code resource.

When the resource is successfully registered, the value of the cell containing the REGISTER command is a text string that is used by the CALL command. A registered command can be called multiple times.

Once registered, the code resource is called using the CALL command.

CALL Command

The following is the format of the CALL command:

   CALL(call_text,argument1,argument2,...)

"call_text" is the value returned by the REGISTER command. It is almost always a reference to the cell containing the REGISTER command. "argument1,argument2,..." is a list of up to 13 arguments passed from Excel to the code resource. These arguments must match in number and type the arguments specified in the REGISTER command. For buffers passed to the resource, a comma is used with no argument.

When the resource is no longer used, it should be unregistered using the UNREGISTER command to free memory taken by the resource.

UNREGISTER Command

The following is the format of the UNREGISTER command:

   UNREGISTER(call_text)

"call_text" is the value returned by the REGISTER command and is almost always a reference to the cell containing the REGISTER command. For more information on calling code resources from Excel, query on the following words:

   description and creating and code and resource and call and
   register and routine and problems and floating and point and
   decimal

MORE INFORMATION

For more information on the CALL, REGISTER, and UNREGISTER commands, see pages 201, 266-267, and 289, respectively, in the "Microsoft Excel Functions and Macros" version 2.2 manual.

Additional information can be found in the "Microsoft Excel Technical Reference for the Macintosh," which is available as part of the Microsoft Excel Development Kit. To obtain this kit, call Microsoft End User Sales and Services at (800) 426-9400.


KBCategory: kbother

KBSubcategory:

Additional reference words: 2.2 2.20


Last reviewed: April 3, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.