当前位置: 代码迷 >> VBA >> 有关于OFFICE编程解决方案
  详细解决方案

有关于OFFICE编程解决方案

热度:10565   发布时间:2013-02-26 00:00:00.0
有关于OFFICE编程
XP系统下安装VC6,SDK,WTL,OFFICE2003以后导入OFFICE2003的类型库
C/C++ code
#import "VBE6EXT.olb" raw_interfaces_only  rename_namespace("VBE6")#import "MSO.DLL" raw_interfaces_only  rename_namespace("Office")#import "EXCEL.EXE" raw_interfaces_only,named_guids rename("RGB","RGBEx"),rename("DialogBox","DialogBoxEx"),rename_namespace("ExcelEx") exclude("IFont","IPicture")#import "MSWORD.OLB" raw_interfaces_only  rename("ExitWindows","ExitWindowsEx"),named_guids,rename_namespace("MSWord")using namespace VBE6;using namespace Office;using namespace ExcelEx;using namespace MSWord;


其中VBE6EXT.olb、MSO.DLL、EXCEL.EXE从office2003安装目录找来的,据说这是office的类型库,可是我用VC6编译没有问题,而移植到visual studio 2005下编译出错
而WTL用的8.0的,SDK用的VS2005自带的那个,如果我另外安装XP\2003\win7的SDK以后错误就更不相同,说是类型重定义,所以我觉得应该是office类型库的问题

以下是错误码
错误 38 error C2664: “MSWord::PictureFormat::put_TransparentBackground”: 不能将参数 1 从“Office::MsoTriState”转换为“MSWord::MsoTriState” src\wordctrl\word.cpp
错误 8 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 1690 ExcelCtrl
错误 9 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 1709 ExcelCtrl
错误 10 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 1759 ExcelCtrl
错误 11 error C2061: 语法错误 : 标识符“MsoRGBType” d:\src\excelctrl\debug\excel.tlh 1767 ExcelCtrl
错误 12 error C2061: 语法错误 : 标识符“MsoRGBType” d:\src\excelctrl\debug\excel.tlh 1769 ExcelCtrl
错误 13 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 1784 ExcelCtrl
错误 14 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 1851 ExcelCtrl
错误 15 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 1868 ExcelCtrl
错误 16 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 1908 ExcelCtrl
错误 17 error C2061: 语法错误 : 标识符“MsoRGBType” d:\src\excelctrl\debug\excel.tlh 1948 ExcelCtrl
错误 18 error C2061: 语法错误 : 标识符“MsoRGBType” d:\src\excelctrl\debug\excel.tlh 1950 ExcelCtrl
错误 19 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 1959 ExcelCtrl
错误 20 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 2002 ExcelCtrl
错误 21 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 2062 ExcelCtrl
错误 22 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 2124 ExcelCtrl
错误 23 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 26462 ExcelCtrl
错误 24 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 26515 ExcelCtrl
错误 25 error C2504: “_IMsoDispObj”: 未定义基类 d:\src\excelctrl\debug\excel.tlh 26542 ExcelCtrl

请问高手,这个问题如何解决

------解决方案--------------------------------------------------------
重复导入了mso.dll
你可以把mso.dll导入到默认的名称空间,然后选择用exclude去掉那些word和excel从mso.dll导入的名字
------解决方案--------------------------------------------------------
C/C++环境下的不懂,帮你顶起来
------解决方案--------------------------------------------------------
我怎么一点也看不懂呢
------解决方案--------------------------------------------------------
excel就是excel.exe
  相关解决方案