Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

I am new to VB and have been trying to create a small app using excel. I went to the Microsoft support page and followed the instructions to add a reference to Excel 15.0 that is installed on my computer and then insert at the top of my Form1 the following "Imports Excel = Microsoft.Office.Interop.Excel" and the "Excel = Microsoft.Office.Interop.Excel" portion is underlined by the editor with no recommended solution. Do I need to upgrade my Visual Studio 2013 or install any add-ons? Any advice is greatly appreciated!

Here is the error I get when attempting to run the code
Warning	1	Namespace or type specified in the Imports 'Microsoft.Office.Interop.Excel' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:\Users\Philip\Documents\Visual Studio 2013\Projects\Excel projects\VBdotNetSetup 5-26-17\VBdotNetSetup 5-26-17\Form1.vb	4	9	VBdotNetSetup 5-26-17


What I have tried:

I have tried searching the Microsoft support pages and have had no luck.
Posted
Updated 4-Jun-17 9:47am
v2
Comments
[no name] 26-May-17 12:14pm    
What does the error message (the most important information you should have included) say?

1 solution

If you go to:

Visual Studio -> Main Menu -> Project -> Add Reference

Choose to see the COM objects, and if you have Microsoft Office installed, you should be able to scroll down to:

Microsoft Excel [xx.x] object library

After that, your IMPORTS declaration should work.
 
Share this answer
 
Comments
Member 13895643 2-Jul-18 17:50pm    
That worked for me - thank you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900