首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

在Delphi中使用Word对象,怎么使用wdPeplaceAll等VBA自带的常量,以及怎么转换

2012-02-14 
在Delphi中使用Word对象,如何使用wdPeplaceAll等VBA自带的常量,以及如何转换wApp.Selection.Find.ClearFor

在Delphi中使用Word对象,如何使用wdPeplaceAll等VBA自带的常量,以及如何转换
wApp.Selection.Find.ClearFormatting;
        wApp.Selection.Find.Replacement.ClearFormatting;
        wApp.Selection.Find.Text:=docText;
        wApp.Selection.Find.Replacment.Text:=newText;
        wApp.Selection.Find.Forward:=True;
        wApp.Selection.Find.Wrap:=wdFindContinue;
        wApp.Selection.Find.Format:=False;
        wApp.Selection.Find.MatchCase:=False;
        wApp.Selection.Find.MatchWholeWord:=True;
        wApp.Selection.Find.MatchByte:=True;
        wApp.Selection.Find.MatchWildcards:=False;
        wApp.Selection.Find.MatchSoundsLike:=Fasle;
        wApp.Selection.Find.MatchAllWordForms:=Fasle;
        wApp.Selection.Find.Execute(Replace:=wdReplaceAll);

wdReplaceAll,wdFindContinue均提示有错
已经Uses   COMOBJ

[解决办法]
安装Word程序
然后: "工具 "- "宏 "- "Visual Basic "编辑器
然后: "视图 "- "对象浏览器 "
然后选择 "所有库 "选项,然后输入你想要查看的常量名如:wdReplaceAll
在对象浏览器的最下方你能看到每个常量的数值

祝你好运

热点排行