![]() |
#2
wzqoo2017-08-04 15:53
|
只有本站会员才能查看附件,请 登录
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleServer, Word2000,comobj;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
msword : Variant ;
begin
MSWord:=CreateOLEObject('Word.Application');
MSWord.Documents.Open(FileName:='G:\商务文件.doc');
MSWord.Visible := 1;
msword.selection.find.clearformatting;
msword.selection.find.replacement.clearformatting;
msword.selection.find.text:=‘数量’ ;
msword.selection.find.replacement.text:=‘产品量’ ;
msword.Selection.Find.Execute(Replace:=wdreplaceall);
end;
end.
为什么图上黑色框住的两个“数量”能替换,文本框中的数量就不能替换呢?
求大神指教