找到解决方法了:不是直接引入mswork.tlh文件的,该文件是#import "C:\\Program Files\\Microsoft Office\\Office12\\MSWORD.OLB"后,编译器自动生成的中间文件,但是这样还是会出现命名空间重复的错误,完整的解决方法如下代码
1
2
3
4
5
6
7
8
|
#import "C:\Program Files\Common Files\Microsoft Shared\OFFICE12\MSO.DLL" #import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB" #import "C:\\Program Files\\Microsoft Office\\Office12\\MSWORD.OLB" no_namespace raw_interfaces_only \ rename ( "FindText" , "_FindText" ) \ rename ( "RGB" , "_RGB" ) \ rename ( "Rectangle" , "_Rectangle" ) \ rename ( "ExitWindows" , "_ExitWindows" ) \ rename ( "Font" , "WordFont" ) |
原文:https://www.cnblogs.com/xzh1993/p/9216610.html