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

Could someone Please translate this VB code to Delphi

uses comobj ;

procedure TForm1.Button1Click(Sender: TObject);
var
 OutlookApplication , OutlookItem : oleVariant ;
begin
   OutlookApplication := CreateOleObject(  'Outlook.Application') ;
   OutlookItem := OutlookApplication.Createitem(0) ;
   OutlookItem.To :=  'f...@myserver.com;f...@blaster.com' ;
   OutlookItem.Subject := 'A message from John' ;
   OutlookItem.Body := txtMsg.Text ;  // or edit1.text or Whatever
   OutlookItem.Send ;

end ;

Paul

Quote
Don Bru wrote in message <7h7fie$mg...@forums.borland.com>...
>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


Is there any way I can get a larger .Body? String literals are only allowed
255 bytes is my error message.

Quote
Paul Qualls <qua...@bigfoot.com> wrote in message

news:7h7t0h$n1210@forums.borland.com...
Quote
> uses comobj ;

> procedure TForm1.Button1Click(Sender: TObject);
> var
>  OutlookApplication , OutlookItem : oleVariant ;
> begin
>    OutlookApplication := CreateOleObject(  'Outlook.Application') ;
>    OutlookItem := OutlookApplication.Createitem(0) ;
>    OutlookItem.To :=  'f...@myserver.com;f...@blaster.com' ;
>    OutlookItem.Subject := 'A message from John' ;
>    OutlookItem.Body := txtMsg.Text ;  // or edit1.text or Whatever
>    OutlookItem.Send ;

> end ;

> Paul

> Don Bru wrote in message <7h7fie$mg...@forums.borland.com>...
> >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