2017-08-01 69 views
2

我想从Excel工作表中发送带有VBA的图片,但是我得到的大小非常小。VBA在MailItem中调整粘贴的JPEG的大小

你现在我怎么能获取到一个更体面的大小

这里是代码(基本全屏幕):

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 = "[email protected]" 
        .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 

非常感谢对谁可以帮我!

+0

你尝试过'r.CopyPicture'而不是'r.Copy'吗?你也可以尝试'wordDoc.Application.CommandBars.ExecuteMSO(“PastePNG”)' –

回答

0

它实际上是很容易的,找到答案的develloppez.com:

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

谢谢!

相关问题