vb.net 如何在控制台应用程序上导入 Microsoft.Office.Interop.Excel?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14826285/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to import Microsoft.Office.Interop.Excel on a console application?
提问by user1676874
It works fine on my Website Application, but I have to use it too on console application that will run from the task scheduler.
它在我的网站应用程序上运行良好,但我也必须在将从任务调度程序运行的控制台应用程序上使用它。
This is how I'm calling the import:
这就是我调用导入的方式:
Imports Excel = Microsoft.Office.Interop.Excel
Problem is when I try to import it from the console app, I get this error:
问题是当我尝试从控制台应用程序导入它时,出现此错误:
Namespace or type specified in the Imports 'Microsoft.Office.Interop.Excel' doesn't contain any public member or cannot be found
Any ideas on how to solve this? Thanks.
关于如何解决这个问题的任何想法?谢谢。
回答by Andrey Gordeev
You should Add Reference
to Microsoft.Office.Interop.Excel
component
你应该Add Reference
到Microsoft.Office.Interop.Excel
组件
回答by eme
with Visual Studio 2013 the answer to this question is to add reference:
使用 Visual Studio 2013 这个问题的答案是添加参考:
Microsoft Excel 15.0 Object Library
Microsoft Excel 15.0 对象库