用BCB打开WORD并替换的问题

Ericzhang1984 2004-04-12 04:55:47
从VBA里查到是下面这个函数。。

Function Execute([FindText], [MatchCase], [MatchWholeWord], [MatchWildcards], [MatchSoundsLike], [MatchAllWordForms], [Forward], [Wrap], [Format], [ReplaceWith], [Replace], [MatchKashida], [MatchDiacritics], [MatchAlefHamza], [MatchControl]) As Boolean

然后偶写成

findtext = "<G#name>";
matchcase = false;
matchwholeword = true;
matchwildcards = false;
matchsoundslike = false;
matchallwordforms = false;
forward = true;
wrap = 1 ;//wdfindcontinue
format = false;
replacewith = "i love you";

Variant start=1,end=10;//这里是为RANGE函数的参数,不过不知道什么意思,胡写
//的

wa->Documents->Open("xxx.doc");
wd->ConnectTo(wa->Documents->Item(itemIndex));
wd->Range(start,end)->Find->Execute( findtext, matchcase, matchwholeword,matchwildcards, matchsoundslike, matchallwordforms, forward,wrap, format, replacewith, replace );

然后他打开文件了,接着抱错说变量类型错误,偶不知道错在哪里了。。。。
...全文
71 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
thp 2004-09-16
  • 打赏
  • 举报
回复

703

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder ActiveX/COM/DCOM
社区管理员
  • ActiveX/COM/DCOM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧