Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem w/ "Imports Excel" giving Error

Status
Not open for further replies.

Cutty201

IS-IT--Management
Nov 10, 2003
28
US
Hello again!
Let me start off by stating that I am new to VB.net and this is probably a very simple problem and I am just not realizing it. Here Goes:

I am trying to learn how to Read/Write to a spreadsheet, so I found this tutorial online:
And I started to read it, and I looked at their example and copied in:

Imports System
Imports System.Reflection ' For Missing.Value and BindingFlags
Imports System.Runtime.InteropServices ' For COMException
Imports Excel

It now gives me a squiggly line under "Excel" with the error:
J:\VB.net Projects\Excel_App\Form1.vb(4): Namespace or type 'Excel' for the Imports 'Excel' cannot be found.

So then I read the top and it said do:
TlbImp Excel9.olb Excel.dll

and again I found no help as doing that returned this error:

TlbImp error: Unable to locate input type library: 'D:\Microsoft Visual Studio .
NET 2003\SDK\v1.1\Bin\Excel9.olb'

what do i do?! :) Thanks in advanced for the help :)
 
You need to add a reference to the Excel 9.0 dll. You right click on references and select

Add Reference

Click on the Com add and look for the

Microsoft Excel 9.0 Object library(or 10.0 depending on which you have)

Click on Accept and then click on OK.

You should see it under the references folder

There is no need to use the "TlbImp Excel9.olb Excel.dll
"

This creates a wraper around the dll so you can use it in .Net. VS does that for you.

DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb
-----------------------------------
If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top