Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert plain text and not attachment
Message
From
04/12/2001 10:24:12
 
 
To
04/12/2001 09:39:33
General information
Forum:
Visual Basic
Category:
COM, DCOM and OLE automation
Miscellaneous
Thread ID:
00589254
Message ID:
00589285
Views:
22
>Hi,
>
>Can someone tell me how I can insert a plain text into
>outlook body (and not attachment) using OLE automation
>through VB? For example following code in Access 2K would
>create the message but it attaches the textfile in stead
>of plain text on the body.
>
>Thanks for any assistance.
>
>Regards
>++++++++++++
>
Private Sub Email2Client(cFileName, cMsgSub)
>    Dim cEmailList As String
>
>    Dim oOutlook As Object
>    Dim oEmailmsg As Object
>
>    Set oOutlook = GetObject(, "outlook.application")
>    Set oEmailmsg = oOutlook.CreateItem(0)
>    cEmailList = "abc@everybody.com"
>    oEmailmsg.Recipients.Add (cEmailList)
>    oEmailmsg.Attachments.Add cFileName, 1
<b>     oEmailmsg.Body = strContents</b>
>    oEmailmsg.Subject = cMsgSub
>    oEmailmsg.Display
>End Sub
>
You would have to read the text file into a string and then assign it to the Body property of the message item. See the change in the code above (assumming that you have read the file contents into the strContents variable)
Previous
Reply
Map
View

Click here to load this message in the networking platform