MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Call a Method of a Add-In

Posted by Anurag Agarwal on October 14, 1999 4:33 AM

How do we call the procedures / functions defined in .bas module of a Add-In which is added to a worksheet.

Thanks in Advance


Posted by Ivan Moala on October 19, 1999 7:39 PM

from Microsoft;
To establish a reference in a Visual Basic module to a project, when you will be copying the module to another computer, do either of the following:

In the module that you want to copy to a different computer, use the References dialog box (Tools menu) to reference the project before you copy the module to a different computer. Then copy the workbook that contains this module, and the referenced project to the same directory on the second computer. When you use this method, Microsoft Excel finds the referenced project and establishes the reference again when you run the procedure.

You can also copy the referenced project to the Microsoft Excel directory, the Microsoft Windows directory, the Microsoft Windows SYSTEM subdirectory, or any directory that is in the MS-DOS path statement.


You can call a Visual Basic procedure that is located in another project by first opening the project file, and then using the Run method of the Application object, and specifying the name of the referenced project and the name of the procedure as in the following example:

Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.
Application.Run "BOOK1.XLS!Macro1"