Visual Basic - insertar imagen en correo desde visual 6

Life is soft - evento anual de software empresarial
 
Vista:

insertar imagen en correo desde visual 6

Publicado por Julian (1 intervención) el 22/09/2011 12:27:20
hola buenos dias. Tengo la necesidad de incrustar una imagen en un email que envio por visual 6 y no se como puedo adjuntarla por codigo. tiene que ir en el cuerpo del mail, no como archivo adjunto. Abro el correo, pongo los destinatarios y todo menos eso. Lo hago usando:

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

solo me faltaria saber como insertar una imagen,
¿alquien podria ayudarme? muchas gracias de antemano por vuestra atencion.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 119
Ha disminuido 1 puesto en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

insertar imagen en correo desde visual 6

Publicado por Christian (713 intervenciones) el 07/10/2011 17:59:24
Dim oApp As Outlook.Application
Dim oMsg As Outlook.MailItem
Dim colAttach As Outlook.Attachments
Dim oAttach As Outlook.Attachment
Dim oPA As Outlook.PropertyAccessor

Const PR_ATTACH_MIME_TAG = "http://schemas.microsoft.com/mapi/proptag/0x370E001E"
Const PR_ATTACH_CONTENT_ID = "urn:schemas:mailheader:content-id"
Const PR_HIDE_ATTACH = "http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8514000B"

On Error Resume Next

Set oApp = Application
Set oMsg = oApp.CreateItem(olMailItem)
Set colAttach = oMsg.Attachments
Set oAttach = colAttach.Add("C:\miImagen.JPG")
oMsg.Save

Set colAttach = Nothing
Set oAttach = Nothing

Set colAttach = oMsg.Attachments
Set oAttach = colAttach.Item(1)
Set oPA = oAttach.PropertyAccessor
oPA.SetProperty PR_ATTACH_MIME_TAG, "image/jpeg"
oPA.SetProperty PR_ATTACH_CONTENT_ID, "myident"
Set oPA = Nothing

Set oPA = oMsg.PropertyAccessor
oPA.SetProperty PR_HIDE_ATTACH, True
oMsg.Save

oMsg.HTMLBody = "<IMG align=baseline border=0 hspace=0 src=cid:myident>"
oMsg.Close olSave
oMsg.Display

Set colAttach = Nothing
Set oAttach = Nothing
Set oPA = Nothing
Set oMsg = Nothing
Set oApp = Nothing
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar