Resize a pasted JPEG in a MailItem

随声附和 提交于 2019-12-23 18:15:00

问题


I am trying to send a picture from an Excel sheet, but the size is very small.

How could I get a decent size (basically the whole screen)?

Here is the code:

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

回答1:


it was actually pretty easy, find the answer on develloppez.com:

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

Thank you!



来源:https://stackoverflow.com/questions/45446208/resize-a-pasted-jpeg-in-a-mailitem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!