View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Robin Hammond[_2_] Robin Hammond[_2_] is offline
external usenet poster
 
Posts: 575
Default Loadin ADD-IN programarically

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

"Ernest" wrote in message
...
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