Certain functionality in the Microsoft Excel object model and in the Microsoft Word object model is tightly integrated with Microsoft Visual Basic for Applications and is not accessible with COM interop. You must use a Visual Basic for Applications wrapper to perform a callback into your assembly to perform the following actions:
- Create Microsoft Excel worksheet user-defined functions (UDFs) to call a function in an assembly.
- Use the OnKey and the OnTime methods of the Microsoft Excel Application object to call a function in an assembly.
- Assign shortcut keys to a function that is exposed in your assembly. To do this, you must use a Visual Basic for Applications wrapper that implements the OnKey method to trap the keystroke and to perform the callback.
This article describes how perform a callback into a Microsoft Visual Studio Tools for the Microsoft Office System assembly to return the value of a function in the assembly by using a Microsoft Excel spreadsheet function. In this example, the function returns the user name to the spreadsheet.