Board index » delphi » Could someone Please translate this VB code to Delphi

Could someone Please translate this VB code to Delphi

Private Sub cmdSend_Click()
  Set outlookApplicationn = CreateObject("outlook.Application")
  Set outlookItem = outlookApplication.CreatItem(0)
  With outlookItem
    .To = "f...@myserver.com;f...@blaster.com"
    .Subject = "A message from John"
    .Body = txtMessage.Text
    .send
  End With
End Sub
 

Re:Could someone Please translate this VB code to Delphi


Don,

It goes something like this:

procedure SendIt()
var
    outlookApp : Variant;
    outlookItem : Variant;
begin

    outlookApp := CreateOleObject('Outlook.Application');
    outlookItem := outlookApp.CreateItem(0);

    with outlookitem do begin
        To :='F...@email.com'
        Subject := 'It is a great night for a moondance';
        Body := txtMessage.text;
        Send;
    end;

    // Clean the object refs up.
    OutlookItem := varEmpty;
    OutlookApp := varEmpty;
end;

Cheers,

Mick.

Quote
Don Bru <irw...@microtech.com.au> wrote in message

news:7h7fie$mgb11@forums.borland.com...
Quote
> Private Sub cmdSend_Click()
>   Set outlookApplicationn = CreateObject("outlook.Application")
>   Set outlookItem = outlookApplication.CreatItem(0)
>   With outlookItem
>     .To = "f...@myserver.com;f...@blaster.com"
>     .Subject = "A message from John"
>     .Body = txtMessage.Text
>     .send
>   End With
> End Sub

Other Threads