CALL function

 Important   Caution      Incorrectly editing the registry may severely damage your operating system, requiring you to reinstall it. Microsoft cannot guarantee that problems resulting from editing the registry incorrectly can be resolved. Before editing the registry, back up any valuable data. For the most recent information about using and protecting your computer's registry, see Microsoft Windows Help.

This article describes the formula syntax and usage of the CALL function (function: A prewritten formula that takes a value or values, performs an operation, and returns a value or values. Use functions to simplify and shorten formulas on a worksheet, especially those that perform lengthy or complex calculations.) in Microsoft Excel.

 Note    The CALL function is not available in Excel Web App.


Calls a procedure in a dynamic link library or code resource. There are two syntax forms of this function. Use syntax 1 only with a previously registered code resource, which uses arguments from the REGISTER function. Use syntax 2a or 2b to simultaneously register and call a code resource.

 Important   This function is provided for advanced users only. If you use the CALL function incorrectly, you may cause errors that will require you to restart your computer. This function is only available from an Excel macro sheet.


Syntax 1

Used with REGISTER


Syntax 2

Used alone (in Microsoft Excel for Windows)

Register_id     is the value returned by a previously executed REGISTER or REGISTER.ID function.


The CALL function syntax has the following arguments (argument: A value that provides information to an action, an event, a method, a property, a function, or a procedure.):

  • Module_text     Required. Quoted text specifying the name of the dynamic link library (DLL) that contains the procedure in Microsoft Excel for Windows.
  • Procedure     Required. Text specifying the name of the function in the DLL in Microsoft Excel for Windows. You can also use the ordinal value of the function from the EXPORTS statement in the module-definition file (.DEF). The ordinal value must not be in the form of text.
  • Type_text     Required. Text specifying the data type of the return value and the data types of all arguments to the DLL or code resource. The first letter of type_text specifies the return value. The codes you use for type_text are described in detail in Using the CALL and REGISTER functions. For stand-alone DLLs or code resources (XLLs), you can omit this argument.
  • Argument1,...     Optional. The arguments to be passed to the procedure.


The following macro formula registers the GetTickCount function from 32-bit Microsoft Windows. GetTickCount returns the number of milliseconds that have elapsed since Microsoft Windows was started.


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


Applies to:
Excel 2010, Excel Web App, SharePoint Online for enterprises, SharePoint Online for professionals and small businesses