3
Outlookのメール本文にワークシートの範囲を画像として埋め込みしようとしています。それは画像を正しく保存していますが、Outlookのメール本文には空白の画像しか表示されません。私はここで間違って何をしていますか?Outlookのメール本文に画像を埋め込む
Sub View_Email()
tName = Trim(MAIN.Range("tEmail"))
If Not tName Like "*@*.*" Then MsgBox "Invalid Email address": Exit Sub
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
'File path/name of the gif file
Fname = ThisWorkbook.Path & "\Claims.jpg"
Set oCht = Charts.Add
STAT.Range("A3:G26").CopyPicture xlScreen, xlBitmap
With oCht
.Paste
.Export Filename:=Fname, Filtername:="JPG"
'.Delete
End With
On Error Resume Next
With OutMail
.To = tName
.CC = ""
.BCC = ""
.Subject = STAT.Range("C1").Value
.HTMLBody = "<html><p>Summary of Claim Status.</p>" & _
"<img src=" & Fname & "' height=520 width=750>"
.display
'.Send 'or use .Display
End With
On Error GoTo 0
'Delete the gif file
'Kill Fname
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
デバッグにコードを試してみて、 'Fname'の値が何であるかをチェックし、手動でファイルの存在を確認してください。ファイルを開いて、チャートがエクスポートされているかどうかを確認してください –
@SiddharthRoutはい私はfnameを確認して、両方がうまくいくように見えますが、Outlook本体には空白の画像が表示されます – newguy
オハイオ州私は理由を知っています... 1つの瞬間に回答を投稿します –