VBA-图片Excel到Outlook的图像调整大小

时间:2018-11-28 10:39:27

标签: excel vba image outlook size

我编写了一个效果很好的代码,但是粘贴在电子邮件上的图片太小了,我想将其放大,但是我一直在寻找正确的代码。

另一个问题是签名在图片旁边,而我希望它在下面几行。

任何人都可以将这两个功能带到我的代码中吗?

Sub Print_and_send()
Dim Sht As Excel.Worksheet
Set Sht = ThisWorkbook.ActiveSheet

Dim rng As Range
Set rng = Sht.Range("D3:Y42")
    rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture

Dim OutApp As Object
Set OutApp = CreateObject("Outlook.Application")

Dim OutMail As Object
Set OutMail = OutApp.CreateItem(0)

Dim vInspector As Object
Set vInspector = OutMail.GetInspector

Dim wEditor As Object
Set wEditor = vInspector.WordEditor


With OutMail
    .To = "youremail"
    .CC = "youremail"

    .Subject = "Test"
    .display


     wEditor.Paragraphs(2).Range.Paste



End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

1 个答案:

答案 0 :(得分:0)

您可以参考以下代码:

 For Each shp In wordDoc.InlineShapes
        shp.ScaleHeight = 90
        shp.ScaleWidth = 90
    Next

有关更多信息,请参考此链接:

Resize a pasted JPEG in a MailItem