Solved

How can I be sure that a MS Excel Object Library is available to my VB.net Application?

Posted on 2014-03-27
6
909 Views
Last Modified: 2014-03-28
I am converting my VB6 application to VB.net using Visual Studio 2013.  The VB6 application is heavily dependent on data imported from and exported to Microsoft Excel files.  My immediate issue is finding a successful method to transfer data from VB.net to Excel.  I used a Microsoft article,  http://support.microsoft.com/kb/301982 , “How to automate Microsoft Excel from Visual Basic .NET,” to develop an example application to transfer data to Excel.  

The VB application develops 17 errors, many of which are duplicates.  I infer from the errors that my required reference to the Microsoft Excel 15.0 Object Library has been unsuccessful.  I also believe there are several unidentified procedures required to make this example work.  I am a novice at using Visual Studio and VB.net so I really don’t have a clue of what to do next to get this example to work.

A sample of the errors follows:
'Imports' statements must precede any declarations.
'Excel.Application' is not defined.
'Excel.Workbook' is not defined.      
'Excel.Range' is not defined.
'Excel' is not declared. It may be inaccessible due to its protection level.
'Excel.Chart' is not defined.
'Excel.Series' is not defined.

Please let me know the best way to proceed in this effort.  I cannot see any evidence that the MS Excel Library is available to my application.  Is there a way to assure it is available?
0
Comment
Question by:Gene Lenning
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 39960887
You have to add a reference.

Right-click on References in your project
Select Extensions on the left
Scroll the list for Microsoft.Office.Interop.Excel
Select it (checkmark)
Click OK
SnapShot
1
 

Author Comment

by:Gene Lenning
ID: 39961509
I had followed the instructions stated in my referenced Microsoft article and added the reference to Microsoft Excel 15.0 Object Library to my application using the method you suggested.  I have no indication the library is available to my application as you observed.  What would interfere with the availability of the reference and what can I do to overcome this problem?
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39961615
Did you follow the steps in my post or only those in the MS article?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Gene Lenning
ID: 39961958
You solved my immediate issue on the references.  Thank you!  I didn't see the checkbox.  I followed your instructions and it did successfully add the reference to the MS Object Library as verified by observing the References via the project Properties display.

The sad part is that I still have the same 17 errors.
0
 

Author Comment

by:Gene Lenning
ID: 39962858
I've requested that this question be closed as follows:

Accepted answer: 0 points for Gene456's comment #a39961958

for the following reason:

The expert immediately provided the answer to my question however I missed the key, the checkbox.  Furthermore I could verify that the library was indeed added to the project reference list.
0
 

Author Closing Comment

by:Gene Lenning
ID: 39962859
Thank you for your help.  I did not see the checkbox required to select the needed library.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Nadia
Linear search (searching each index in an array one by one) works almost everywhere but it is not optimal in many cases. Let's assume, we have a book which has 42949672960 pages. We also have a table of contents. Now we want to read the content on p…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question