Referencing Excel Add-In from ASP.NET

JThompson

New member
Joined
Aug 24, 2006
Messages
1
Programming Experience
Beginner
Hello,

I'm working on a project to create a web based solution for use with our OLAP software (Applix TM1 specifically).

The relevant code is as follows:

VB.NET:
Dim oExcel As Excel.Application
Dim oBook As Excel.WorkbookClass
Dim oBooks As Excel.Workbooks
Dim tm1 As New TM1Admin 'TM1Admin contains all TM1 function declarations mainly used later in code
 
'Start Excel and open the workbook.
 
oExcel = CreateObject("Excel.Application", "\\localhost")
oExcel.Visible = False
oBooks = oExcel.Workbooks
oBook = oBooks.Open("C:\test.xls")
 
tm1.hUser = oExcel.Run("tm1_api2han") 'hUser is of type Long
The problem lies in the fact that the 'tm1_api2han' macro only exists within an Excel Add-In called TM1 (tm1p is the actual file name) that loads automatically when Excel starts. The only exception is that this ad-in doesn't load when Excel is opened in the manner above. So my ultimate question is how can I reference this add-in in my vb.NET program?

Any help/suggestions is greatly appreciated even if it is outside the scope of my question.
 
Last edited by a moderator:
Hi there,

Sorry, can't help you on this one .... I just wanted to ask what your solution is as I am experiencing a very similar problem.

I have a Windows Application created through VS 2005, I can create an Excel session and 'load' TM1P.XLA but it doesn't register with the Excel session. The main code looks like this:

VB.NET:
Sub LoadExcel()
 
Dim oApp as Excel.Application
Dim oAddIn as Excel.AddIn
 
oApp = New Excel.Application
With oApp
.Workbooks.Add
oAddIn = .AddIns.Add("C:\Program Files\Applix\bin\tm1p.xla", True)
oAddIn.Installed = True
.RegisterXll("C:\Program Files\Applix\bin\tm1p.xll")
.Workbooks("C:\Program Files\Applix\bin\tm1p.xla").RunAutoMacros 1
End With
 
End Sub
Everything works ok until the RunAutoMacros section which produces a HRESULT exception (bad index).

Any ideas?
Thanks
Robin
 
Last edited by a moderator:
Back
Top