Excel 接收器可以';在Outlook电子邮件中看不到图像

Excel 接收器可以';在Outlook电子邮件中看不到图像,excel,vba,image,email,outlook,Excel,Vba,Image,Email,Outlook,我在Outlook中发送电子邮件时无法显示图像。在我的电子邮件发送功能中,我在word文档的开头添加了一个inlineshape图片,所有内容都显示得很好,但是当我发送电子邮件时,inlineshape图片和我签名中的图片都消失了。请参阅下面的屏幕截图和代码。我试图寻找答案,但没有成功 Sub Send_Email( _ strTo As String, _ Optional strFromEmail As String, _

我在Outlook中发送电子邮件时无法显示图像。在我的电子邮件发送功能中,我在word文档的开头添加了一个inlineshape图片,所有内容都显示得很好,但是当我发送电子邮件时,inlineshape图片和我签名中的图片都消失了。请参阅下面的屏幕截图和代码。我试图寻找答案,但没有成功

Sub Send_Email( _
            strTo As String, _
            Optional strFromEmail As String, _
            Optional strSubject As String, _
            Optional strCC As String, _
            Optional strBCC As String, _
            Optional BodyFormat As olBodyFormat = olFormatPlain, _
            Optional varBody1 As Variant, _
            Optional strPicturePath As String, _
            Optional lngPicutreSize As Long = 100, _
            Optional varBody2 As Variant, _
            Optional strAttachmentPath As String, _
            Optional blnSendEmail As Boolean = False)

Dim olApp As Outlook.Application
Set olApp = New Outlook.Application

Dim olEmail As Outlook.MailItem
Set olEmail = olApp.CreateItem(olMailItem)

Dim olInsp As Outlook.Inspector
Dim wdDoc As Word.document
Dim shpEmailShape As Word.InlineShape

With olEmail
    .BodyFormat = BodyFormat
    .display
    If strFromEmail <> "" Then
        .SentOnBehalfOfName = strFromEmail
    End If
    .To = strTo
    .Subject = strSubject
    .CC = strCC
    .BCC = strBCC
    If BodyFormat = olFormatHTML Then
        If varBody2 <> "" Then
            .HTMLBody = varBody2 & "<br>" & .HTMLBody
        End If
        If varBody1 <> "" Then
            .HTMLBody = varBody1 & "<br>" & .HTMLBody
        End If
    ElseIf BodyFormat = olFormatRichText Then
        Set olInsp = .GetInspector
        Set wdDoc = olInsp.WordEditor
        If IsMissing(varBody2) = False Then
            varBody2.Copy
            wdDoc.Range(0, 0).Paste
        End If
        If strPicturePath <> "" Then
            Set shpEmailShape = wdDoc.Range(0, 0).InlineShapes.AddPicture(strPicturePath)
            shpEmailShape.LockAspectRatio = msoCTrue
            shpEmailShape.Height = lngPicutreSize
        End If
        If IsMissing(varBody1) = False Then
            varBody1.Copy
            wdDoc.Range(0, 0).Paste
        End If
    Else
        On Error Resume Next
        If varBody2 <> "" Then
            .body = varBody2 & vbCrLf & .body
        End If
        On Error GoTo 0
        On Error Resume Next
        If varBody1 <> "" Then
            .body = varBody1 & vbCrLf & .body
        End If
        On Error GoTo 0
    End If
    If strAttachmentPath <> "" Then
        .Attachments.Add strAttachmentPath
    End If
End With

If blnSendEmail = True Then
    olEmail.send
End If
Sub发送电子邮件(_
strTo作为字符串_
可选的strFromEmail作为字符串_
可选strSubject作为字符串_
可选strc作为字符串_
可选strBCC作为字符串_
可选的BodyFormat为olBodyFormat=olFormatPlain_
可选varBody1作为变型_
可选strPicturePath作为字符串_
可选lngPicutreSize,只要长度=100_
可选varBody2作为变型_
可选strAttachmentPath作为字符串_
可选的blnSendEmail(布尔值=False)
Dim olApp作为Outlook.Application
Set olApp=newoutlook.Application
以Outlook.MailItem的形式发送邮件
设置olEmail=olApp.CreateItem(olMailItem)
将SP设置为Outlook.Inspector
将wdDoc设置为Word.document
将形状设置为Word.InlineShape
用电子邮件
.BodyFormat=BodyFormat
.展示
如果是strfmail“”,则
.SentonBehalfName=strFromEmail
如果结束
.To=strTo
.Subject=strSubject
.CC=strCC
.BCC=strBCC
如果BodyFormat=olFormatHTML,则
如果varBody2“,则
.HTMLBody=varBody2&“
”&.HTMLBody 如果结束 如果varBody1“,则 .HTMLBody=varBody1&“
”&.HTMLBody 如果结束 ElseIf BodyFormat=olFormatRichText然后 设置olInsp=.GetInspector 设置wdDoc=olInsp.WordEditor 如果IsMissing(varBody2)=False,则 Varbody 2.收到 wdDoc.范围(0,0).粘贴 如果结束 如果strPicturePath为“”,则 设置shEmailShape=wdDoc.Range(0,0).InlineShapes.AddPicture(strPicturePath) shmailshape.LockAspectRatio=msoCTrue shpmailshape.Height=lngPicutreSize 如果结束 如果IsMissing(varBody1)=False,则 Varbody 1.收到 wdDoc.范围(0,0).粘贴 如果结束 其他的 出错时继续下一步 如果varBody2“,则 .body=varBody2&vbCrLf和.body 如果结束 错误转到0 出错时继续下一步 如果varBody1“,则 .body=varBody1&vbCrLf和.body 如果结束 错误转到0 如果结束 如果是strAttachmentPath“”,则 .Attachments.Add strAttachmentPath 如果结束 以 如果blnSendEmail=True,则 邮件发送 如果结束


听起来您确实是以RTF格式发送的。您需要发送一封HTML格式的邮件,其中图像作为附件添加,并由HTML正文引用。

Hi Dmitry!是的,我正在使用RTF格式类型来处理这封特殊的电子邮件。我希望能够继续使用它,因为它可以更容易地将一系列单元格添加到电子邮件正文中。对于RTF电子邮件类型,没有办法做到这一点吗?感谢您的帮助。OLE对象的RTF是特定于Outlook的,Google和其他电子邮件客户端可能有问题。