Hello all,
I am developing a project and want to use excel in it. I have followed all the steps which Microsoft has provided http://support.microsoft.com/kb/307473/EN-US/ and still I have few problems

In step 6 when I add #include "CApplication.h" to "AutoProject.cpp", I am getting a lot of errors.

Code:
1>------ Build started: Project: AtPr, Configuration: Debug Win32 ------
1>Compiling...
1>AtPr.cpp
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(982) : error C2371: 'FontPtr' : redefinition; different basic types
1>        c:\program files\microsoft visual studio 9.0\vc\include\comdef.h(327) : see declaration of 'FontPtr'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1060) : error C2786: 'BOOL (__stdcall *)(HDC,int,int,int,int)' : invalid operand for __uuidof
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1060) : error C2923: '_com_IIID' : 'Rectangle' is not a valid template type argument for parameter '_Interface'
1>        c:\program files\microsoft sdks\windows\v6.0a\include\wingdi.h(3667) : see declaration of 'Rectangle'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1060) : error C3203: '_com_IIID' : unspecialized class template can't be used as a template argument for template parameter '_IIID', expected a real type
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1060) : error C2955: '_com_IIID' : use of class template requires template argument list
1>        c:\program files\microsoft visual studio 9.0\vc\include\comip.h(40) : see declaration of '_com_IIID'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1064) : error C2786: 'BOOL (__stdcall *)(HDC,int,int,int,int,int,int,int,int)' : invalid operand for __uuidof
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1064) : error C2923: '_com_IIID' : 'Arc' is not a valid template type argument for parameter '_Interface'
1>        c:\program files\microsoft sdks\windows\v6.0a\include\wingdi.h(2914) : see declaration of 'Arc'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1064) : error C3203: '_com_IIID' : unspecialized class template can't be used as a template argument for template parameter '_IIID', expected a real type
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1064) : error C2955: '_com_IIID' : use of class template requires template argument list
1>        c:\program files\microsoft visual studio 9.0\vc\include\comip.h(40) : see declaration of '_com_IIID'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1071) : error C2371: 'PicturePtr' : redefinition; different basic types
1>        c:\program files\microsoft visual studio 9.0\vc\include\comdef.h(341) : see declaration of 'PicturePtr'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1358) : error C2504: '_IMsoDispObj' : base class undefined
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1400) : error C2504: '_IMsoDispObj' : base class undefined
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1502) : error C2504: '_IMsoDispObj' : base class undefined
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1519) : error C2146: syntax error : missing ';' before identifier 'GetRGB'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1519) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1519) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1519) : warning C4183: 'GetRGB': missing return type; assumed to be a member function returning 'int'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1521) : error C2061: syntax error : identifier 'MsoRGBType'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1534) : error C2061: syntax error : identifier 'MsoRGBType'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1536) : error C2061: syntax error : identifier 'MsoRGBType'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1547) : error C2504: '_IMsoDispObj' : base class undefined
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1849) : error C2146: syntax error : missing ';' before identifier 'GetTransparencyColor'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1849) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1849) : warning C4183: 'GetTransparencyColor': missing return type; assumed to be a member function returning 'int'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1851) : error C2061: syntax error : identifier 'MsoRGBType'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(1906) : error C2504: '_IMsoDispObj' : base class undefined
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(4556) : error C2011: 'Font' : 'struct' type redefinition
1>        c:\program files\microsoft visual studio 9.0\vc\include\comdef.h(325) : see declaration of 'Font'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(6741) : warning C4003: not enough actual parameters for macro 'DialogBoxW'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(6741) : error C2059: syntax error : ','
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(15800) : error C2011: 'Picture' : 'struct' type redefinition
1>        c:\program files\microsoft visual studio 9.0\vc\include\comdef.h(339) : see declaration of 'Picture'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(16759) : error C2146: syntax error : missing ';' before identifier 'Scripts'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(16759) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62282) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62282) : error C2497: 'MsoRGBType' : 'implementation_key' can only be applied to function declarations
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62282) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62283) : error C2146: syntax error : missing ')' before identifier 'RGB'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62283) : error C2182: 'PutRGB' : illegal use of type 'void'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62283) : error C2497: 'ColorFormat::PutRGB' : 'implementation_key' can only be applied to function declarations
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62283) : error C2350: 'ColorFormat::PutRGB' is not a static member
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62346) : error C2497: 'MsoRGBType' : 'implementation_key' can only be applied to function declarations
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62346) : error C2086: 'int MsoRGBType' : redefinition
1>        c:\projects\tt\atpr\atpr\debug\excel9.tlh(62282) : see declaration of 'MsoRGBType'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62346) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62347) : error C2146: syntax error : missing ')' before identifier 'TransparencyColor'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62347) : error C2182: 'PutTransparencyColor' : illegal use of type 'void'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62347) : error C2497: 'PictureFormat::PutTransparencyColor' : 'implementation_key' can only be applied to function declarations
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62347) : error C2350: 'PictureFormat::PutTransparencyColor' is not a static member
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62347) : error C2440: 'initializing' : cannot convert from 'int' to 'void (void)'
1>        There are no conversions to function types, although there are conversions to references or pointers to functions
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62347) : error C2059: syntax error : ')'
1>        c:\program files\microsoft visual studio 9.0\vc\include\comdef.h(325) : see declaration of 'Font'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62468) : error C2027: use of undefined type 'Font'
1>        c:\program files\microsoft visual studio 9.0\vc\include\comdef.h(325) : see declaration of 'Font'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62469) : error C2027: use of undefined type 'Font'
1>        c:\program files\microsoft visual studio 9.0\vc\include\comdef.h(325) : see declaration of 'Font'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62470) : error C2027: use of undefined type 'Font'
1>        c:\program files\microsoft visual studio 9.0\vc\include\comdef.h(325) : see declaration of 'Font'
1>c:\projects\tt\atpr\atpr\debug\excel9.tlh(62470) : fatal error C1003: error count exceeds 100; stopping compilation
1>Build log was saved at "file://c:\Projects\TT\AtPr\AtPr\Debug\BuildLog.htm"
1>AtPr - 187 error(s), 25 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Can someone please tell me how can I solve this problem and is there any other good tutorial to lear how to automate Excel using MFC.

Thanks in Advance