SAMPLE: FRMWRK32.EXE: Updated Generic.xll Template for Excel

ID: Q152152


The information in this article applies to:
  • Microsoft Excel Software Development Kit 5.0 for:
    • Microsoft Excel for Windows NT, version 5.0
    • Microsoft Excel


SUMMARY

The sample code provided contains a template that can used for writing 32-bit Microsoft Excel XLLs for Windows. This code demonstrates many of the features of the Microsoft Excel C API. This sample was updated from the Microsoft Excel Developer's Kit, version 5.

The following file is available for download from the Microsoft Download Center. Click the file name below to download the file:

Frmwrk32.exe
For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center.


MORE INFORMATION

Creating Stand-alone DLLs (XLLs)

Microsoft Excel supports stand-alone DLLs. These are DLLs (or code resources) that the user opens by choosing Open from the File menu and selecting a DLL file or by using the Microsoft Excel Add-In Manager. The user can also put DLL files in the Microsoft Excel Startup directory so that they are opened at run time. By convention, stand-alone DLLs are called XLLs. After the DLL is built, the DLL should be given a filename with the extension .XLL. When using an XLL, the user never sees a macro sheet or Add-In sheet. Therefore, an XLL must be able to do everything an XLA (Add-In) can do. In particular, XLLs need a way to provide functions that run automatically at open time, close time, and so on. When developing an XLL, you need to:
  • Define the interface to Microsoft Excel. An XLL should export a few functions that are called by Microsoft Excel and the Microsoft Excel Add-In Manager.


  • Define the user interface to the XLL. Does the XLL use pull-down menus, toolbars, or shortcut keys? Or does it only provide additional functions for use on worksheets?


The Generic Template for XLLs

The sample code provided contains a template you can use for writing your own 32-bit Microsoft Excel XLLs. This code demonstrates many of the features of the Microsoft Excel C API. To see the generic Add-In code, open GENERIC.C from the sample. When the compiled generic Add-In, GENERIC.XLL, is opened in Microsoft Excel, it creates a new Generic menu with the four Commands listed in the following table:


   Command            Action
   -------------------------------------------------------------------

   Dialog             Displays a Microsoft Excel dialog box
   Dance              Moves the selection around until you press ESC
   Native Dialog      Displays a Windows dialog box that was created
                      using the Windows API
   Exit               Closes GENERIC.XLL and removes the menu 


The generic Add-In also provides two functions, Func1 and FuncSum, that can be used whenever the generic Add-In is open. These functions appear in the Generic Add-In category in the Function Wizard. Also, these functions can be registered without loading all of the generic Add-In. To do this, use the following formulas:


   =REGISTER("GENERIC.XLL","FUNC1")
   =REGISTER("GENERIC.XLL","FUNCSUM") 

To Build

This project must be built as a 32-bit application. NMAKE can be used with the attached makefile to build this project.


REFERENCES

Microsoft Excel Developer's Kit, version 5.

Additional query words:

Keywords : kbfile kbsample kbusage
Version :
Platform : NT WINDOWS
Issue type :


Last Reviewed: December 3, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.