VC将数据写入EXCEL出错,帮忙看看,该如何处理

VC将数据写入EXCEL出错,帮忙看看
在BOOL CVCExcelApp::InitInstance()之中,int nResponse = dlg.DoModal()语句之后加入如下代码: 
if(!AfxOleInit())///初始化COM库
  {
  AfxMessageBox("初始化COM失败");
  return FALSE;
  } 
  为了能调用Excel的接口我们打开MFC ClassWizard->Automation->Add Class->From a type library,选择[Excel的安装路径]\EXCEL.exe,然后把所有的类都添加进去,头文件为excel.h,源文件为excel.cpp。当然,你也可以只把一些比较常用的类如_Application、Workbooks、_Workbook、Worksheets、_Worksheet、Range加进去,因为网上流传的绝大部分教程都只添加这几个类,这完全根据你个人的需要。但在本例中我们至少还要用到Interior类(设置底色),Font类(设置字体),而且这样做又简单又方便扩展功能,不管三七二十一全部弄进去吧!但这样做会有一个问题,有可能产生类的名字冲突,例如本来你自己写了一个类叫Font,当你全部添加时又再次加入了Font类,这样就重复定义了,不过可以通过名字空间来解决这个问题。再在VCExcelDlg.cpp文件的头部添加(如果系统已经自动添加就不要重复添加了): 
#include "VCExcel.h" 
#include "comdef.h" 
这样一来我们的程序就可以自由调用EXCEL了,一切准备就绪。 

我按了上面步骤进行添加excel类了,但是为什么会运行错误呢?我是在现有的工程添加类的,错误为:
Compiling...
excel.cpp
c:\documents and settings\chenbikui\桌面\testmenu\excel.h(7879) : warning C4099: 'Parameter' : type name first seen using 'struct' now seen using 'class'
  d:\work\汽车仪表检测\soft\testmenu\debug\msado15.tlh(97) : see declaration of 'Parameter'
c:\documents and settings\chenbikui\桌面\testmenu\excel.h(7909) : error C2011: 'Parameters' : 'struct' type redefinition
c:\documents and settings\chenbikui\桌面\testmenu\excel.h(10594) : error C2011: 'Errors' : 'struct' type redefinition
c:\documents and settings\chenbikui\桌面\testmenu\excel.h(10615) : error C2011: 'Error' : 'struct' type redefinition
C:\Documents and Settings\chenbikui\桌面\testmenu\excel.cpp(43000) : error C2039: 'GetApplication' : is not a member of 'Parameters'
  d:\work\汽车仪表检测\soft\testmenu\debug\msado15.tlh(2035) : see declaration of 'Parameters'
C:\Documents and Settings\chenbikui\桌面\testmenu\excel.cpp(43003) : error C2065: 'InvokeHelper' : undeclared identifier
C:\Documents and Settings\chenbikui\桌面\testmenu\excel.cpp(43007) : error C2039: 'GetCreator' : is not a member of 'Parameters'
  d:\work\汽车仪表检测\soft\testmenu\debug\msado15.tlh(2035) : see declaration of 'Parameters'
C:\Documents and Settings\chenbikui\桌面\testmenu\excel.cpp(43014) : error C2039: 'GetParent' : is not a member of 'Parameters'
  d:\work\汽车仪表检测\soft\testmenu\debug\msado15.tlh(2035) : see declaration of 'Parameters'
C:\Documents and Settings\chenbikui\桌面\testmenu\excel.cpp(43021) : error C2039: 'Add' : is not a member of 'Parameters'
  d:\work\汽车仪表检测\soft\testmenu\debug\msado15.tlh(2035) : see declaration of 'Parameters'
C:\Documents and Settings\chenbikui\桌面\testmenu\excel.cpp(43032) : error C2509: 'GetCount' : member function not declared in 'Parameters'
  d:\work\汽车仪表检测\soft\testmenu\debug\msado15.tlh(2035) : see declaration of 'Parameters'
C:\Documents and Settings\chenbikui\桌面\testmenu\excel.cpp(43039) : error C2063: 'Item' : not a function
C:\Documents and Settings\chenbikui\桌面\testmenu\excel.cpp(43039) : error C2040: 'Item' : 'struct IDispatch *(const struct tagVARIANT &)' differs in levels of indirection from 'class _com_ptr_t<class _com_IIID<struct _Parameter,&struct __s_GUID _GU
ID_0000050c_0000_0010_8000_00aa006d2ea4> >'
C:\Documents and Settings\chenbikui\桌面\testmenu\excel.cpp(43039) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\excel.sbr': No such file or directory
Error executing bscmake.exe.



假如我新建一个工程,按如上方法添加excel类的时候没有报错,不知道上面的错误是什么回事,请大牛们帮忙,多谢!!!

------解决方案--------------------
http://www.cnblogs.com/slaughter/archive/2008/05/07/1187223.html
------解决方案--------------------
http://blog.sina.com.cn/s/blog_4504388f0100073f.html