Help with Excel.Application error!

I'm trying to open an Excel file, and populate certain fields with data, then save it. However, I keep getting the following error:

Compiler Error Message: BC30002: Type 'Excel.Application' is not defined.
Source Error:
Line 77: Sub CreateExcelForm()
Line 78:
Line 79: Dim MyExcel As New Excel.Application()
Line 80: Dim oWorkbooks As Excel.Workbooks = MyExcel.Workbooks
Line 81: Dim theWorkbook As Excel.Workbook = oWorkbooks.Add

I've tried importing numerous namespaces, but still no luck. I've used the following:

<%@ Import Namespace = "System.IO"%>
<%@ Import Namespace = "System.Runtime.InteropServices"%>
<%@ Import Namespace = "Microsoft.Office.Interop"%>
<%@ import Namespace = "System.Runtime.InteropServices.Marshal" %>
<%@ import Namespace = "Microsoft.Office.Interop.Excel" %>
<%@ import Namespace = "System.Runtime.InteropServices.Marshal.GetActiveObject" %>
<%@ Import Namespace = "System.Office"%>
<%@ Import Namespace = "Excel" %>
<%@ Import Namespace = "Excel.ApplicationClass" %>

Am I missing one, or am I just going about this whole thing the wrong way? Any help would be greatly appreciated!

9/23/2003 3:14:12 PM 91979 articles. 2 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 0

I'll go for the obvious one - is Excel installed on the webserver that is attempting to run this page

Sorry if that sounds patronising - it is not intended to do so
Various IBS Addons available at

Lead Developer [vb & c#] - MCAD
9/23/2003 3:31:35 PM
Yup, sure is. That was the first thing I thought of. Any other suggestions??
9/23/2003 3:47:45 PM