load xll programmatically

199 views
Skip to first unread message

valeri...@mclink.net

unread,
Mar 28, 2012, 4:03:10 PM3/28/12
to Excel-DNA
Hello Govert,
I've successfully built and tested my Udf library.
Now a requirement of mine says: "users must use our custom Udfs only
from a custom excel file, the custom udf functions must not be
available from Excel in other ways".
So I decided to build a document-level addin in visualstudio (with
ribbons, action panes, etc... and also some variables that have to be
used as parameters in my udf functions).
In the debugging phase I double click the custom xls file (that loads
data from db and fills cells on sheet1) and then open (with file--
>Open...) the xll file. In this way my custom xls file loads its stuff
first, and then can access the udf functions.
Now the question is: how can I deploy to the end user this solution?
I think I will have to programmatically load the xll addin at the very
startup of the custom document, even before that the custom document
begin to load its own stuff, am I right?
Is it a correct approach?
If so, have you any example on how to load programmatically an xll
file?
But may be i'm thinking in a bad way the solution, and may be a single
xll with custom UI interfaces is the best way. Anyway, in this case I
still can't imagine how could I satisfy my requirement.

Another question not really related to the above words is: how can I
force a whole recalculation of the sheet?
Thanks in advance for your kindness
valerio

Govert van Drimmelen

unread,
Mar 28, 2012, 4:22:43 PM3/28/12
to Excel-DNA
Hi Valerio,

If you are targeting .NET 4, you should be able to load the .xll with
a call to Application.RegisterXLL(...).

If both the Excel-DNA add-in and the VSTO add-in target .NET 2.0, I
don't know how to load the Excel-DNA add-in from a VSTO add-in (see
http://groups.google.com/group/exceldna/browse_frm/thread/f2e4f4fb9dca1b72).

There is a Worksheet.Calculate() method, from VSTO I think you call it
as Worksheet.CalculateMethod().

Regards,
Govert


On Mar 28, 10:03 pm, "valerioro...@mclink.net"
Reply all
Reply to author
Forward
0 new messages