Loadin ADD-IN programarically

G

Guest

I am starting Excel using Office interop from C# code in ASP.NET web
application. I also have Excel spreadsheet which using some 3rd party addin
library doing calculation and outputing the result to spreadsheet. I need to
open spreadsheet, pass data in input range, calculate and read data back from
output range. I can do everything, expect loading 3rd party library. As
Excel load I need it to be able to load all addins and libraries as it do
during interactive load.
Please advise
 
R

Robin Hammond

Ernest,

I'm not sure about doing it from c#, but this is what you would need in vba
to load an addin.

Dim aiTemp as AddIn
Dim strAddinName as string
Dim strAddInPath as string
strAddInName = "MyAddin"
strAddInPath = "c:\temp\MyAddin.xla"
If ActiveSheet Is Nothing Then Workbooks.Add
On Error Resume Next
Set aiTemp = Application.AddIns(strAddInName)
On Error Goto 0
If aiTemp Is Nothing Then Application.AddIns.Add (strAddInPath)
Application.AddIns(strAddInName).Installed = True

Robin Hammond
www.enhanceddatasystems.com
 

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