VS2005的Excel操作(一) - 添加Excel命名空间的支持

本文介绍了在VS2005中使用Excel进行编程时,如何添加Microsoft Excel Object Library引用,并解决因Copy Local属性设置错误导致的编译问题。文中提及Office 2003的修复、重装和注册表修复方法,强调在安装Office时需选择.NET Programmability Support以确保正确引用。
摘要由CSDN通过智能技术生成

在VS2005中对Excel进行编程,首先要在对象引用中添加Microsoft Excel Object Libray,对于Office2003,应该是Microsoft Excel 11 Object Libray,Office2007则是Microsoft Excel 12 Object Libray.

 

添加引用的方法可以参见文章

《使用COM组件实现对Excel文件的操控

 

按照上述文章,我第一次添加Excel对象库的时候,引用中也出现了Excel,但是程序一直编译不过,后来再查资料,在MSDN的一篇文章发现了问题所在:

 

When you select the referenced IA in Solution Explorer, if the Copy Local property in the Properties pane is set to True, you are referencing an autogenerated IA, not the PIA. You should remove this reference and add the correct one. If you correctly reference the Excel 2003 PIA, your Excel reference's Copy Local property will be False and the Path property, on a Windows XP machine, should look something like t

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值