Avatar of FCapo
FCapo
 asked on

Type excel.application is not defined

Hi,

I'm using visual basic 2010, I'm trying to use excel from Vb.net but I keep getting the following error when using the following code: type excel.application is not defined

dim xl as excel.application
dim wb as excel.workbook
dim ws as excel.worksheet

I've added the following references:
Microsoft Excel 14.0 Object Library
Microsoft Office 14.0 Object Library
Microsoft visual basic for application s extensibility 5.3
micrisoft.office.interop.excel

and then imported the following :
Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop
Imports System.Data

I use word without any issues :

Dim appWord As Word.Application
Dim docWord As Word.Document

How come excel doesn't work the same way?
Visual Basic.NET

Avatar of undefined
Last Comment
Jacques Bourgeois (James Burger)

8/22/2022 - Mon
kaufmed

I believe you also need the import:

Imports Microsoft.Office.Interop.Excel
kaufmed

Actually, strike that. I read your declarations incorrectly.
Nasir Razzaq

That is strange. It should work.

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel(v=office.11).aspx

what happens if you import

Imports Microsoft.Office.Interop.Excel

and then use just application?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
Jacques Bourgeois (James Burger)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.