Microsoft KB Archive/100944

{|
 * width="100%"|

XL3/XL4: Macro to Open an Add-in for Editing

 * }

-

The information in this article applies to:


 * Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a
 * Microsoft Excel for OS/2, version 3.0
 * Microsoft Excel for the Macintosh, versions 3.0, 4.0

-

SUMMARY
In the versions of Microsoft Excel listed above, it is possible to create a macro that will open an add-in macro sheet so that you can edit it.

MORE INFORMATION
To manually open a Microsoft Excel add-in macro sheet for edit it, you have to hold down the SHIFT key when you open the file. To simulate this behavior in a macro, use the method appropriate to your version of Microsoft Excel.

Microsoft provides programming examples 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 article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp

Microsoft Excel Version 3.0 or 4.0
To open an add-in macro for editing in Microsoft Excel version 3.0 or 4.0, you can use the following sample macro code

  A1: =OPEN("ADDIN.XLA") A2: =ACTIVATE("ADDIN.XLA") A3: =NEW.WINDOW A4: =ACTIVATE("ADDIN.XLA:1") A5: =CLOSE A6: =RETURN

where:


 * Cell A1 of the macro opens the add-in macro ADDIN.XLA, which remains invisible.
 * Cell A2 activates ADDIN.XLA.
 * Cell A3 creates a new window, titled "ADDIN.XLA:2." Because of the way in which the NEW.WINDOW command works, this new window is visible.
 * Cell A4 activates ADDIN.XLA:1, which is still invisible.
 * Cell A5 closes the ADDIN.XLA:1 window. Since there is only one other window containing ADDIN.XLA (ADDIN.XLA:2), that window's title changes to ADDIN.XLA.
 * Cell A6 ends the macro.

Microsoft Excel for Windows or OS/2
To open an add-in macro for editing in Microsoft Excel for Windows or Microsoft Excel for OS/2, you can use the following sample macro code

  A1: =SEND.KEYS("%FO",TRUE) A2: =SEND.KEYS("ADDIN.XLA+~",TRUE) A3: =RETURN

where:


 * Cell A1 of the macro sends the key combination ALT+F+O, which is the same as selecting Open from the File menu.
 * Cell A2 sends the name of the add-in macro (ADDIN.XLA) followed by a SHIFT+ENTER key combination. This is equivalent to holding down the SHIFT key while opening the add-in macro.
 * Cell A3 ends the macro.

NOTE: This second method does not work in Microsoft Excel for the Macintosh because the SEND.KEYS command is not available in Microsoft Excel for the Macintosh.