Created
September 7, 2011 05:36
-
-
Save crazyfool2100/1199848 to your computer and use it in GitHub Desktop.
A host ExcelDna add-in loading and unloading another add-in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<DnaLibrary Name="Sample Add-In" Language="CS" RuntimeVersion="v4.0"> | |
<Reference AssemblyPath="System.Windows.Forms.dll"/> | |
<Reference Name="Microsoft.Office.Interop.Excel" /> | |
<![CDATA[ | |
using System; | |
using ExcelDna.Integration; | |
using System.Windows.Forms; | |
using Excel = Microsoft.Office.Interop.Excel; | |
public class MyAddIn : IExcelAddIn | |
{ | |
public void AutoOpen() | |
{ | |
Excel.Application XL = (Excel.Application)ExcelDnaUtil.Application; | |
XL.OnKey("^p", "Macro_Test"); | |
MessageBox.Show("Add-In Loaded.", "Add-In AutoOpen"); | |
} | |
public void AutoClose() | |
{ | |
} | |
public static void Macro_Test() | |
{ | |
MessageBox.Show("Macro Test", "Macro Test"); | |
} | |
} | |
]]> | |
</DnaLibrary> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment