Skip to content

Instantly share code, notes, and snippets.

View crazyfool2100's full-sized avatar

crazyfool2100

View GitHub Profile
public class MyCom : ExcelDna.Integration.CustomUI.ExcelComAddIn
{
public MyCom()
{
}
public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
{
}
public void OnDisconnection(ext_DisconnectMode RemoveMode, ref Array custom)
{
public class MyCom : ExcelDna.Integration.CustomUI.ExcelComAddIn
{
public MyCom()
{
}
public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
{
}
public void OnDisconnection(ext_DisconnectMode RemoveMode, ref Array custom)
{
<DnaLibrary RuntimeVersion="v4.0" Language="C#">
<Reference Name="System.Windows.Forms" />
<Reference Name="Microsoft.Office.Interop.Excel" />
<![CDATA[
using System;
using System.Reflection;
using System.Windows.Forms;
using ExcelDna.Integration;
using ExcelDna.Integration.CustomUI;
using ExcelDna.Integration.Extensibility;
@crazyfool2100
crazyfool2100 / gist:1079974
Created July 13, 2011 09:18
This add-in causes problems with embedded Excel sheets in Microsoft Word documents.
<DnaLibrary RuntimeVersion="v4.0" Language="C#">
<Reference Name="System.Windows.Forms" />
<Reference Name="Microsoft.Office.Interop.Excel" />
<![CDATA[
using System;
using System.Reflection;
using System.Windows.Forms;
using ExcelDna.Integration;
using ExcelDna.Integration.CustomUI;
using ExcelDna.Integration.Extensibility;
/***************************************************************************
* Copyright ©2008; Microsoft Corporation. All rights reserved.
* Written by Microsoft Office Developer Support
*
* This code is provided as a sample. It is not a formal
* product and has not been fully tested. Use it
* for educational purposes only.
*
* THIS CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
@crazyfool2100
crazyfool2100 / gist:1079996
Created July 13, 2011 09:32
Excel-DNA solution to errors that result from attaching to Excel events within a managed add-in and then attemping to edit embedded sheets within Word. Based on code provided at: http://blogs.msdn.com/b/vsofficedeveloper/archive/2008/04/11/excel-ole-embed
using System;
using System.Windows.Forms;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;
using ExcelDna.Integration;
using ExcelDna.Integration.Extensibility;
using ExcelDna.Integration.CustomUI;
@crazyfool2100
crazyfool2100 / Host Add-In
Created September 7, 2011 05:34
A host ExcelDna add-in loading and unloading another add-in
<DnaLibrary Name="Host 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 HostAddIn: IExcelAddIn
@crazyfool2100
crazyfool2100 / Sample Add-In
Created September 7, 2011 05:36
A host ExcelDna add-in loading and unloading another add-in
<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