the CALL function

Contents

Welcome back to our frequent blog of Excel functions from A to Z. Today we look at the CALL function.

The CALL function

Look, before we go anywhere here, this function is for Advanced users only. If you use the CALL it works incorrectly, you may be looking for a new computer; good, in the best case, you will have to restart your PC. This function is only enabled from an Excel macro sheet whatever the case. Be careful with this tool!

This function calls a procedure in a dynamic link library or a code resource. There are two syntax alternatives for this function. Use the first syntax only with a pre-registered code resource, which uses arguments from CHECK IN function. Use the second syntax to simultaneously register and call a code resource.

Then, from above, the CALL The function employs two different types of syntax operate.

Syntax 1:

Used with CHECK IN:

CALL (register_id, [argument1], …)

where register_id is the value returned by a previously executed CHECK IN O REGISTRO.ID function.

Syntax 2:

Used alone (in Microsoft Excel for Windows):

CALL (text_module, process, text_type, [argument1], …])

The CALL The function has the following arguments:

  • module_text: this is required and is rendered as text in quotes that specifies the name of the dynamic link library (DLL) containing the procedure in Microsoft Excel for Windows
  • process: additionally required. This is a text that specifies the name of the function in the DLL in Microsoft Excel for Windows. You can also use the ordinal value of the function of the EXPORTS declaration in module definition file (.DEF). The ordinal value must not be in the form of text.
  • type the text: again, required. This is a text that specifies the data type of the return value and the data types of all the arguments of the DLL or the code resource. The first letter of type the text specifies the return value. The codes you use to type the text are described in detail in Using the CALL and REGISTER functions. For standalone DLLs or code resources (XLL), you can omit this argument
  • argument1, …: Optional. These are the arguments that will be passed to the procedure.

The next macro formula records the GetTickCount Microsoft Windows function of 32 bits. GetTickCount returns the number of milliseconds that have elapsed since Microsoft Windows started:

CHECK IN(“Kernel32”, “GetTickCount”, “J”)

Assuming this CHECK IN The function is in cell A5, after your macro records GetTickCount, you can use the CALL function to return the number of milliseconds that have elapsed:

Maybe not for the faint-hearted.

Soon we will continue with our functions from A to Z of Excel. Keep checking: there is a new blog post every other business day.

Subscribe to our Newsletter

We will not send you SPAM mail. We hate it as much as you.