Microsoft KB Archive/179008

= MacXL: How to Create an Add-in File in Microsoft Excel =

Article ID: 179008

Article Last Modified on 1/22/2007

-

APPLIES TO


 * Microsoft Excel 2001 for Mac
 * Microsoft Excel 98 for Macintosh

-



This article was previously published under Q179008



SUMMARY
In the versions of Microsoft Excel listed at the beginning of this article, the process you use to create an add-in file is different from the process you use for earlier versions of Microsoft Excel. This article contains detailed information about how to create an add-in file in Microsoft Excel 98 Macintosh Edition and later versions.



Add-in File Behavior
An add-in file in Microsoft Excel is a special type of workbook. An add-in file can contain worksheets, chart sheets, and Visual Basic for Applications procedures and functions. Procedures and functions in an add-in file add optional commands and features to Microsoft Excel without allowing a user to directly view or edit them.

Unlike normal workbooks, when you open an add-in file, it is not visible on the screen, and you cannot unhide it by clicking Unhide on the Window menu. An add-in file is displayed in the Project Explorer window in the Visual Basic Editor. However, you cannot view or edit an add-in file if it is protected with a password.

How to Create an Add-in File
To create an add-in file, use the following two-part process:
 * First, protect the projects in the workbook to prevent them from being viewed or edited after you create the add-in file.
 * Then, save the workbook as an add-in file.

In Microsoft Excel 98 Macintosh Edition and later versions, it is very important to protect the projects. In earlier versions of Microsoft Excel, it is not necessary to protect the contents of an add-in file. However, in Microsoft Excel 98 Macintosh Edition and later versions, if you do not protect projects in the workbook, others can view or edit the sheets and Visual Basic modules in the add-in file.

For more information about how to convert an add-in back into a workbook, click the article number below to view the following article in the Microsoft Knowledge Base:

179007 MacXL: How to Convert an Add-in File into a Workbook

How to Protect the Projects in a Workbook
To protect the projects in a workbook, follow these steps:  In Microsoft Excel, click the workbook that you want to convert to an add-in file. Point to Macro on the Tools menu, and then click Visual Basic Editor. In the Project Explorer window in the Visual Basic Editor, click the following bold entry

 

where  is the name of the Visual Basic project, and   is the name of the workbook that you want to convert.

For example, the entry will be similar to the following:

VBAProject (Mybook.xls)

 On the Tools menu, click  Properties. Click the Protection tab. Click to select the Lock project for viewing check box. Type a password in the Password box. Type the same password in the Confirm password box, and then click OK.</ol>

How to Save the Workbook as an Add-in File
To save the workbook as an add-in file, follow these steps:
 * 1) Close the Visual Basic Editor by clicking Close and Return to Microsoft Excel on the File menu.
 * 2) On the File menu, click Properties.
 * 3) Click the Summary tab.
 * 4) In the Title box, type any name for the add-in.

The name that you provide will be the name that appears in the Add-Ins dialog box.
 * 1) In the Comments box, type any text that describes the add-in.

This description will be displayed in the Add-Ins dialog box when you select the add-in, in the list of available add-ins.
 * 1) Click OK to close the Properties dialog box.
 * 2) On the File menu, click Save As.
 * 3) In the Save As dialog box, click Microsoft Excel Add-In in the Save File As Type list (Excel 98), or in the Format list (Excel 2001). If you want, change the file name, and click Save.

When you click Save, Microsoft Excel creates the add-in.
 * 1) On the File menu, click Close.

After you create the add-in file, you can open the add-in file the same way you open any workbook. If the add-in file contains an Auto_Open macro, the macro runs and performs any actions for which it is programmed. Any functions and subroutines in the add-in file are available for use in Microsoft Excel.

Additional query words: XL98 make making subroutine kbprg xlloadsave xlui xlvbahowto xlvbainfo

Keywords: kbfaq kbprb kbprogramming KB179008

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.