【问题标题】:Resize a pasted JPEG in a MailItem在 MailItem 中调整粘贴的 JPEG 大小
【发布时间】:2018-01-08 19:34:29
【问题描述】:

我正在尝试从 Excel 工作表发送图片,但尺寸非常小。

我怎样才能获得合适的尺寸(基本上是整个屏幕)?

代码如下:

Sub send_as_a_pic()
    'Copy range of interest
    Dim r As Range
    Set r = Range("B2:O23")
    r.Copy

    'Open a new mail item
    Dim outlookApp As Outlook.Application
    Set outlookApp = CreateObject("Outlook.Application")
    Dim outMail As Outlook.MailItem
    Set outMail = outlookApp.CreateItem(olMailItem)

    With outMail
        .To = "fernando.grespan@fernando.com"
        .CC = ""
        .BCC = ""
        .Subject = "PAC 2017 sales up to date"
    End With

    'Get its Word editor
    outMail.Display
    Dim wordDoc As Word.Document
    Set wordDoc = outMail.GetInspector.WordEditor

    'To paste as picture
    wordDoc.Range.PasteAndFormat wdChartPicture

    'With wordDoc.Range
     '   .LockAspectRatio = True
      '  .Top = wordDoc.Top
       ' .Left = wordDoc.Left
        '.Height = wordDoc.RowHeight
    'End With

End Sub

【问题讨论】:

  • 你试过r.CopyPicture而不是r.Copy吗?你也可以试试wordDoc.Application.CommandBars.ExecuteMSO("PastePNG")

标签: excel vba outlook jpeg mailitem


【解决方案1】:

其实很简单,在 develloppez.com 上找到答案:

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

谢谢!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-09
    • 1970-01-01
    相关资源
    最近更新 更多