4 Replies - 385 Views - Last Post: 23 April 2014 - 02:14 AM Rate Topic: -----

#1 ZRonZ  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 206
  • Joined: 09-January 09

Microsoft.Office.Interop.Excel

Posted 20 April 2014 - 09:53 PM

Taking up VB.NET again after several years away from programming.

I am starting a project where I need to pull data from an Excel spreadsheet to do some calculations. I copied code from an old project written in VB.NET 2008 and am trying to use it in VB.NET 2013 Express for Desktop and I am using Excel 2013 on Windows 7 machine.

The problem is the Imports line is not valid
 Imports excel = Microsoft.Office.Interop.Excel


I added the reference to Microsoft Excel 15.0 Object Library before inserting the code, but it still comes up as invalid. What am I missing? I just don't remember.

Just call me Rusty...

Is This A Good Question/Topic? 0
  • +

Replies To: Microsoft.Office.Interop.Excel

#2 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3817
  • View blog
  • Posts: 13,532
  • Joined: 12-December 12

Re: Microsoft.Office.Interop.Excel

Posted 21 April 2014 - 03:42 AM

What's the error message? If there is a wavy line under it you can point at it and a message displays.

You probably haven't placed it at the top of your file.
Was This Post Helpful? 0
  • +
  • -

#3 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1623
  • View blog
  • Posts: 5,199
  • Joined: 25-September 09

Re: Microsoft.Office.Interop.Excel

Posted 21 April 2014 - 06:10 AM

Also, double check to ensure that the reference was added. I've hilighted the reference without actually checking the checkbox and had this happen.
Was This Post Helpful? 1
  • +
  • -

#4 ZRonZ  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 206
  • Joined: 09-January 09

Re: Microsoft.Office.Interop.Excel

Posted 22 April 2014 - 02:53 PM

Sorry for the delay getting back to you, had to drop out of circulation for a while.

The problem I was seeing was that there was no option for Office or Excel when entering the imports statement.

Here's what I did:

1. I rebooted the machine since I hadn't done it in a few days.
2. Previously I had googled it and read in a couple of places about how you MUST add the reference to Microsoft Excel Object Library before you add the Import statement. So, I tried it after.

Mysteriously it's taking the imports statement now so it's on to the data mining...

Thanks for your attention.

ZRonZ
Was This Post Helpful? 0
  • +
  • -

#5 supyae  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 10-April 14

Re: Microsoft.Office.Interop.Excel

Posted 23 April 2014 - 02:14 AM

Creating an Excel Application from VB.Net

Let's start with creating a Window Forms Application by following the following steps in Microsoft Visual

Studio: File -> New Project -> Windows Forms Applications
Finally, select OK,

Add a reference to Microsoft Excel Object Library to your project. To do this:

1. Select Add Reference from the Project Menu.

2. On the COM tab, locate Microsoft Excel Object Library and then click Select.

3. Click OK.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1