P
passrift
Unregistered / Unconfirmed
GUEST, unregistred user!
用下面的事件打开一文档,当WORD是已运行时没有问题,但当WORD是未运行状态,则出现如下错误提示:[系统为WIN2000]
Project Project.exe raised exception class EOleSysError with message'操作无法使用'.Process stopped.Use Step or Run to continue.
procedure TForm1.Button1Click(Sender: TObject);
var
Word_Handle, Doc_Handle: OleVariant;
Word_Button: OleVariant;
begin
try
Word_Handle := GetActiveOleObject('Word.Application');
except
try
Word_Handle := CreateOleObject('Word.Application');
except
Exit;
end;
end;
Word_Handle.Visible := True;
Doc_Handle := Word_Handle.Documents.open(FileName := 'C:/1.doc');
end;