导入excel = microsoft.office.interop.excel不起作用 [英] Imports excel = microsoft.office.interop.excel is not working

查看:417
本文介绍了导入excel = microsoft.office.interop.excel不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我是VB的新手,并且一直在尝试使用excel创建一个小应用程序。我转到Microsoft支持页面并按照说明添加对我的计算机上安装的Excel 15.0的引用,然后在我的Form1顶部插入以下Imports Excel = Microsoft.Office.Interop.Excel和 Excel = Microsoft.Office.Interop.Excel部分由编辑器加下划线,没有推荐的解决方案。我是否需要升级Visual Studio 2013或安装任何附加组件?非常感谢任何建议!



这是我在尝试运行代码时遇到的错误

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.

推荐答案

如果你去:



Visual Studio - >主菜单 - >项目 - >添加引用



选择查看COM对象,如果安装了Microsoft Office,则应该可以向下滚动到:



Microsoft Excel [xx.x]对象库



之后,您的IMPORTS声明应该有效。
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.


这篇关于导入excel = microsoft.office.interop.excel不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆