Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Insert plain text and not attachment
Message
De
04/12/2001 10:24:12
 
 
À
04/12/2001 09:39:33
Information générale
Forum:
Visual Basic
Catégorie:
COM, DCOM et OLE automation
Divers
Thread ID:
00589254
Message ID:
00589285
Vues:
24
>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)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform