By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,538 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

Using a C# class file as an Excel Automation add-in

P: n/a

I've written the class below and compiled it with the 'Register for COM
Interop' option set to true and I can see the resulting .dll file.
However, I can not successfully pull it into the Add-in list from Excel
Tools Add-in Automation.
I tried copying code straight from this official Microsoft link:

I have also tried installing the following patch:

I am using MS Office Professional 2003 with a complete installation of
Excel, .NET Framework 2.0 and Microsoft Visual C# Express Edition, and
I'd imported the Excel 5.0 Object Library as a project reference.

I'd really appreciate some help as am quite stuck.

Thank you in advance.


using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.Text;

namespace CSharpAddIn
public class Functions
public Functions()

public double NormDensity(double x)
return Math.Exp(-x * x * 0.5) / Math.Sqrt(2 * Math.PI);


//Stuff to deal with the registry below
public static void RegisterFunction(Type type)

public static void UnRegisterFunction(Type type)
GetSubKeyName(type), false);

private static string GetSubKeyName(Type type)
StringBuilder subKeyName = new StringBuilder();
return subKeyName.ToString();


Jan 20 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.