Oh my teacher's XLL question

F

Fredrik Wahlgren

To Forum said:
hi all,
I was asked to write a simple Excel Add-in which take the sum of two
numbers. Well, we can have a direct answer with
http://www.codeproject.com/dotnet/excelnetauto.asp . What is the different
between this approach and the XLL approach, using pure C++ apart from
language?
My best regard.
TF
As I see it, the main problem with the automation addin is that you have to
enter as many values as there are parameters.
If you don't, excel won't call the code, thus

=Add2(2,0) -> 2 OK
=Add2(2) -> #NAME?

This won't happen in an xll, in the latter case excel will return 2 as
expected. I belib´ve you will get the same problem if you use VB6 or VB.NET
even if you make bothe parameters optional and assign 0 as default.

Another difference is that if you want to have amnu bar as well as UDF's
such as add2, yuou need to register the dll both as a COM add-in and an
automation add-in. There's no such distinction in an xll.
I also belive the xll approach is easier if you want to pass a Range, as you
can do with the built in SUM function.

/ Fredrik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top