Ray Luttermoser
Guest
|
I would like to insert text into a reply without over writing the original message. Not sure what I'm doing wrong?
Delphi 5 Ent. SP1
Win XP
Office 2003
procedure TAddInModule.adxOlExplorerCommandbar1Controls1Click(
Sender: TObject);
var
VIntf: OLEVariant;
begin
VIntf := OutlookApp.ActiveExplorer.Selection.Item(1);
// this works but over writes the original message
VIntf.HTMLBody := 'Put this text in the reply message...';
// this dosent work at all...
//VIntf.Reply.HTMLBody := 'Put this text in the reply message...';
// this works - reply to selected email
VIntf.Reply.Display(true);
end;
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hi Ray,
Try the code below. It has been tested on Windows XP Prof SP2 and Office 2003 SP2. Works fine.
procedure TAddInModule.adxOlExplorerCommandbar1Controls0Click(Sender: TObject);
var
Index: Integer;
S: WideString;
IMail, IReplyMail: _MailItem;
begin
OutlookApp.ActiveExplorer.Selection.Item(1).QueryInterface(IID__MailItem, IMail);
if Assigned(IMail) then
try
IReplyMail := IMail.Reply;
S := IReplyMail.HTMLBody;
Index := Pos('<BODY>', S);
if Index > 0 then begin
Insert('Put this text in the reply message...<BR>', S, Index + Length('<BODY>'));
IReplyMail.HTMLBody := S;
end;
IReplyMail.Display(False);
finally
IReplyMail := nil;
IMail := nil;
end;
end;
|
|
Ray Luttermoser
Posts: 1
Joined: 2005-10-18
|
Dmitry,
It all makes sense now. I over looked the need to use
QueryInterface(IID__MailItem, IMail);
Thanks for the code example.
BTW, Add-in's express is an excellent product. Keep up the great work.
|
|