Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Manipulating Excel in ASP.net

'  creat a Application object        
    oXL = New ApplicationClass()

Hi I am getting an error with the code above. Do I need to add a reference to my ASP.net project?
Error      1      Interop type 'ApplicationClass' cannot be embedded. Use the applicable interface instead.      C:\Users\User\Documents\Visual Studio 2010\Projects\Excel1\Excel1\Default.aspx.vb      26      19      Excel1
ASKER CERTIFIED SOLUTION
Avatar of Mlanda T
Mlanda T
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did you tried?
Dim app As New Microsoft.Office.Interop.Excel.Application

Open in new window


What Excel references are you using? may be "Microsoft Excel 12.0 Object Library"?
You need to declare the variable as Microsoft.Office.Interop.Excel.Application, but instantiate it as Microsoft.Office.Interop.Excel.ApplicationClass.

Dim app As Microsoft.Office.Interop.Excel.Application = New Microsoft.Office.Interop.Excel.ApplicationClass

Open in new window

Another tip, If you plan to manipulate Excel files, I recommend you to use OleDb (Microsoft Jet 4.0), it have better performance but it's more limited.
Avatar of Murray Brown

ASKER

thanks