VC操作Excell中的Range.SetValue

我完全按照Microsoft客户帮助和支持主页的程序例子做的,
http://support.microsoft.com/kb/178749/#top

我改成操作EXCEL2003,
第9步的时候选择Office   2003   中的   Excel.exe   文件的默认位置为   C:/Program   Files/Microsoft   Office/Office11/Excel.exe
头文件为:
#include   "excel.h "//   excel.h   in   the   case   of   Excel   2002   and   Excel   2003.


编译的时候,下面的代码,出现问题:
            //Fill   cells   A1,   B1,   C1,   and   D1   one   cell   at   a   time   with   "headers ".
            range   =   sheet.GetRange(COleVariant( "A1 "),COleVariant( "A1 "));
            range.SetValue(COleVariant( "First   Name "));
            range   =   sheet.GetRange(COleVariant( "B1 "),COleVariant( "B1 "));
            range.SetValue(COleVariant( "Last   Name "));
            range   =   sheet.GetRange(COleVariant( "C1 "),COleVariant( "C1 "));
            range.SetValue(COleVariant( "Full   Name "));
            range   =   sheet.GetRange(COleVariant( "D1 "),COleVariant( "D1 "));
            range.SetValue(COleVariant( "Salary "));
编译信息:
Compiling...
AutoProjectDlg.cpp
C:/Documents   and   Settings/naga610/桌面/AutoProject/AutoProjectDlg.cpp(248)   :   error   C2660:   'SetValue '   :   function   does   not   take   1   parameters
C:/Documents   and   Settings/naga610/桌面/AutoProject/AutoProjectDlg.cpp(250)   :   error   C2660:   'SetValue '   :   function   does   not   take   1   parameters
C:/Documents   and   Settings/naga610/桌面/AutoProject/AutoProjectDlg.cpp(252)   :   error   C2660:   'SetValue '   :   function   does   not   take   1   parameters
C:/Documents   and   Settings/naga610/桌面/AutoProject/AutoProjectDlg.cpp(254)   :   error   C2660:   'SetValue '   :   function   does   not   take   1   parameters
Error   executing   cl.exe.
Creating   browse   info   file...

AutoProject.exe   -   4   error(s),   0   warning(s)

原因是:excel2003的函数变了,将SetValue函数改成SetValue2可以了.

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值