使用 VBA 在 Outlook 中嵌入图像 [英] Embedding Image in Outlook with VBA

查看:48
本文介绍了使用 VBA 在 Outlook 中嵌入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的代码不起作用.它嵌入了照片但不显示,因为文件可能已被移动、重命名或删除.请确认链接指向正确的文件和位置."

The below code isn't working. It embeds the photo but doesn't display because "The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location."

我知道文件路径是正确的,因为我已经检查了三倍.一双新鲜的眼睛可能会有所帮助.

I know the file path is correct since I've tripled check. A fresh set of eyes could help.

Sub mail()

Dim Sig As String

Set myOlApp = CreateObject("Outlook.Application")

LR400 = Columns(1).Find("*", SearchDirection:=xlPrevious).Row

sPath = Environ("appdata") & "MicrosoftSignaturesAmir Higgs.txt"

For x = 2 To LR400


    If Cells(x, 2) <> "no email" Then

     emails = Cells(x, 1)
    'TheBody1 = "The Parallon Workforce Team" & vbCrLf & vbCrLf & vbCrLf & _
    "Amir Higgs" & vbCrLf & _
    "Accounts Payable Clerk" & vbCrLf & _
    "Parallon Workforce Solutions" & vbCrLf & _
    "1000 Sawgrass Corporate Pkwy, 6th Floor" & vbCrLf & _
    "Sunrise, FL 33323" & vbCrLf & _
    "P:  954-514-1656" & vbCrLf & _
    "www.parallon.com"


    Set myitem = myOlApp.CreateItem(olMailItem)

    With myitem
    .SentOnBehalfOfName = "PARA.WFAdjustments@Parallon.com"
    .To = Cells(x, 2)
    .Subject = Cells(x, 3)
    .Body = TheBody1
    '.CC = ""
    .Attachments.Add emails
    .Attachments.Add "C:UsersJoeSchmoPicturesWF Communications.jpg", olByValue, 0
    .HTMLBody = "<BODY><IMG src=""cid:WF Communications.jpg"" width=200> </BODY>"

    .display

    End With

End If

Next x

Set OutMail = Nothing
Set OutApp = Nothing

End Sub

推荐答案

把你的JPG文件名改为一个词 Example WF_Communications.jpgWFCommunications.jpg

Change your JPG file name to one word Example WF_Communications.jpg or WFCommunications.jpg

.Attachments.Add "C:UsersJoeSchmoPicturesWF_Communications.jpg", olByValue, 0
.HTMLBody = "<BODY><IMG src=""cid:WF_Communications.jpg"" width=200> </BODY>"

这篇关于使用 VBA 在 Outlook 中嵌入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆