Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / December 2004

Tip: Looking for answers? Try searching our database.

Creating an Excel Automation Add-In using C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Emmanuel - 02 Dec 2004 13:13 GMT
Hi,

Does anyone know where can I find documentation on how to create an Excel
automation add-in ?

Attention: I am talking about an Excel Automation add-in and not a standard
COM Add-In.
I want to be able to create my own Excel functions that are served by my
.NET dll.

The only thing I have found so far is an article at
http://www.codeproject.com/dotnet/excelnetauto.asp

Please help

Thanks

Emmanuel
Paul Clement - 02 Dec 2004 15:08 GMT
¤ Hi,
¤
¤ Does anyone know where can I find documentation on how to create an Excel
¤ automation add-in ?
¤
¤ Attention: I am talking about an Excel Automation add-in and not a standard
¤ COM Add-In.
¤ I want to be able to create my own Excel functions that are served by my
¤ .NET dll.
¤
¤ The only thing I have found so far is an article at
¤ http://www.codeproject.com/dotnet/excelnetauto.asp
¤
¤ Please help

Did you check out the Microsoft KB article listed:

http://support.microsoft.com/kb/q285337/

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
Emmanuel - 02 Dec 2004 15:50 GMT
Hi Paul,

Thanks but I have already checked this article.

This article does not use .NET and I do not consider it as
documentation on how to create an automation add-in in Excel using C#
or even .NET Framework in general.

There are many questions involved such as:

Q1. If I want to create a function say:  add(double x, double y) that
returns
      the sum of x and y, which is the right way to create the function ?
      If the fuction is created like that:
         public double Add( double x, double y )
        {
            return x + y;
         }
      it does work for "=Add(1,2)" but NOT for "=Add(A1,A5)".
      I discovered by myself how to achive this but without documentation.

Q2. If the data supplied by my application change, how can I force Excel to
      recalculate all my add-in functions. F9 does not work. The only way I
      have found so far is to select the cell that has the function, then
press F2
      then press ENTER.

Q3. For some strange reason when I select the Add-in functions from
      Tools->Add-In->Automation... (Excel 2003) I get the message
      "Cannot find add-in 'mscoree.dll'. Delete from the list?" If I answer
      No the function seem to work OK.

Anyway I think that some documentation would clear up some issues.

Thank you

Emmanuel

First of all it is

> ? Hi,
> ?
[quoted text clipped - 19 lines]
> Paul ~~~ pclement@ameritech.net
> Microsoft MVP (Visual Basic)
Paul Clement - 02 Dec 2004 20:13 GMT
¤ Hi Paul,
¤
¤ Thanks but I have already checked this article.
¤
¤ This article does not use .NET and I do not consider it as
¤ documentation on how to create an automation add-in in Excel using C#
¤ or even .NET Framework in general.
¤
¤ There are many questions involved such as:
¤
¤ Q1. If I want to create a function say:  add(double x, double y) that
¤ returns
¤        the sum of x and y, which is the right way to create the function ?
¤        If the fuction is created like that:
¤           public double Add( double x, double y )
¤          {
¤              return x + y;
¤           }
¤        it does work for "=Add(1,2)" but NOT for "=Add(A1,A5)".
¤        I discovered by myself how to achive this but without documentation.
¤
¤ Q2. If the data supplied by my application change, how can I force Excel to
¤        recalculate all my add-in functions. F9 does not work. The only way I
¤        have found so far is to select the cell that has the function, then
¤ press F2
¤        then press ENTER.
¤
¤ Q3. For some strange reason when I select the Add-in functions from
¤        Tools->Add-In->Automation... (Excel 2003) I get the message
¤        "Cannot find add-in 'mscoree.dll'. Delete from the list?" If I answer
¤        No the function seem to work OK.
¤
¤ Anyway I think that some documentation would clear up some issues.
¤

Actually I posted the wrong KB article. I was looking at the following:

http://support.microsoft.com/default.aspx?scid=kb;en-us;302896
http://support.microsoft.com/default.aspx?scid=kb;en-us;302901

However, this article probably does not address your questions and I haven't seen any more
comprehensive documentation.

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
Emmanuel - 02 Dec 2004 21:11 GMT
Paul,

As I have already stated I am not interested in COM Add-in documentation
for dotnet but for documentation for Excel Automation Add-in which is a
different thing.

Thanks for the try.

Anyone else ?

Can anyone answer my questions ?

Please help

Emmanuel

> ? Hi Paul,
> ?
[quoted text clipped - 48 lines]
> Paul ~~~ pclement@ameritech.net
> Microsoft MVP (Visual Basic)
"Peter Huang" [MSFT] - 03 Dec 2004 05:59 GMT
From: v-phuang@online.microsoft.com ("Peter Huang" [MSFT])
Date: Fri, 03 Dec 2004 03:47:28 GMT
Subject: Re: Creating an Excel Automation Add-In using C#
Newsgroups: microsoft.public.dotnet.framework.interop

Hi

Comments in line.

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Emmanuel" <Emmanuel@newsgroup.nospam>
>References: <uJ5fFEH2EHA.4028@TK2MSFTNGP15.phx.gbl>
<osbuq0dga3igl12rth4is66la9bn6o4sa5@4ax.com>
>Subject: Re: Creating an Excel Automation Add-In using C#
>Date: Thu, 2 Dec 2004 17:50:22 +0200
[quoted text clipped - 8 lines]
>NNTP-Posting-Host: mail.tricom.gr 83.235.219.178
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12
phx.gbl
>Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.interop:27962
>X-Tomcat-NG: microsoft.public.dotnet.framework.interop
[quoted text clipped - 19 lines]
>       it does work for "=Add(1,2)" but NOT for "=Add(A1,A5)".
>       I discovered by myself how to achive this but without documentation.

I can not reproduce the problem, the =Add(A1,A5)" or =Add(1,2)  will both
work.
Based on my test with samples below.
http://www.codeproject.com/dotnet/excelnetauto.asp
or
http://blogs.msdn.com/eric_carter/archive/2004/12/01/273127.aspx

You may have a try on another machine to see if that works.

>Q2. If the data supplied by my application change, how can I force Excel to
>       recalculate all my add-in functions. F9 does not work. The only way I
>       have found so far is to select the cell that has the function, then
>press F2
>       then press ENTER.

This may be caused that you did not turn on the Excel automatic calculation
option.
You may navigate to Tools/Options/Calculation
in the Calculation section, please check the Automatic, so that the formula
will be re-calculated automatically.

>Q3. For some strange reason when I select the Add-in functions from
>       Tools->Add-In->Automation... (Excel 2003) I get the message
>       "Cannot find add-in 'mscoree.dll'. Delete from the list?" If I answer
>       No the function seem to work OK.

You may try take a look at the linke below.
http://www.codeproject.com/dotnet/excelnetauto.asp?df=100&forumid=78701&sele
ct=896559#xx896559xx

Find the "Unable to find mscoree.dll"
=====
When I ran this I received the error "Unable to find mscoree.dll". I did
some research and discovered that some applications are unable to find it
when the full path is not specified in the registry.

To fix this we need to add the following to the end of the RegisterFunction
method:

Microsoft.Win32.RegistryKey key =
Microsoft.Win32.Registry.ClassesRoot.CreateSubKey(
"CLSID\\{" + t.GUID.ToString().ToUpper() +
"}\\InprocServer32");
key.SetValue("", @"C:\Windows\System32\mscoree.dll");
======

>Anyway I think that some documentation would clear up some issues.
>
>Thank you
>
>Emmanuel
"Peter Huang" [MSFT] - 03 Dec 2004 03:47 GMT
Hi

Comments in line.

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Emmanuel" <Emmanuel@newsgroup.nospam>
>References: <uJ5fFEH2EHA.4028@TK2MSFTNGP15.phx.gbl>
<osbuq0dga3igl12rth4is66la9bn6o4sa5@4ax.com>
>Subject: Re: Creating an Excel Automation Add-In using C#
>Date: Thu, 2 Dec 2004 17:50:22 +0200
[quoted text clipped - 8 lines]
>NNTP-Posting-Host: mail.tricom.gr 83.235.219.178
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12
phx.gbl
>Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.interop:27962
>X-Tomcat-NG: microsoft.public.dotnet.framework.interop
[quoted text clipped - 19 lines]
>       it does work for "=Add(1,2)" but NOT for "=Add(A1,A5)".
>       I discovered by myself how to achive this but without documentation.

I can not reproduce the problem, the =Add(A1,A5)" or =Add(1,2)  will both
work.
Based on my test with samples below.
http://www.codeproject.com/dotnet/excelnetauto.asp
or
http://blogs.msdn.com/eric_carter/archive/2004/12/01/273127.aspx

You may have a try on another machine to see if that works.

>Q2. If the data supplied by my application change, how can I force Excel to
>       recalculate all my add-in functions. F9 does not work. The only way I
>       have found so far is to select the cell that has the function, then
>press F2
>       then press ENTER.

This may be caused that you did not turn on the Excel automatic calculation
option.
You may navigate to Tools/Options/Calculation
in the Calculation section, please check the Automatic, so that the formula
will be re-calculated automatically.

>Q3. For some strange reason when I select the Add-in functions from
>       Tools->Add-In->Automation... (Excel 2003) I get the message
>       "Cannot find add-in 'mscoree.dll'. Delete from the list?" If I answer
>       No the function seem to work OK.

This is caused by that factor that using the managed code as automation
Addin, we must use the mscoree.dll's help. while it did not expose the
function, so we just delete it.

>Anyway I think that some documentation would clear up some issues.
>
>Thank you
>
>Emmanuel

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.