Search code examples
delphioutlooktry-except

Issue of using outlook2000 unit in Delphi


Am trying to use the unit 'outlook2000' but something wrong happned to my Try statements and I get Error: E2021 Class type required . if I excuted my app without this unit or without Except then everything is fine .

Uses ...,outlook2000;

procedure TForm1.Button1Click(Sender: TObject);
var
S:string;
begin
try
s:='Hello';
Except On E:Exception do
ShowMessage(E.Message);

end;
end;

Can anyboady explains what is the wrong . Am using Delphi 10.1 Berlin , Win 10.

enter image description here


Solution

  • The only reason I know this is because just the other day this baffled me as well with a similar situation.

    Change your Except On:Exception to except on E:System.SysUtils.Exception. It's because the outlook2000 unit also has an interface called Exception but we're looking for the object declared in SysUtils.