从Excel复制并粘贴Outlook作为图像 - VBA [英] Copy from Excel and paste on Outlook as image - VBA

查看:685
本文介绍了从Excel复制并粘贴Outlook作为图像 - VBA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我需要复制范围"x"中的一些信息。并将其粘贴到Outlook上的新邮件中,但我需要粘贴为图像。

我做了直到在Outlook上打开新邮件,但我不知道如何粘贴复制的范围作为图像。

I need to copy some information from range "x" and paste it in a new message on Outlook, but I need to paste as image.
I did until opening a new message on Outlook, but I don't know how to paste the range copied as image.

有人可以帮助我吗?

我试图插入"theMailItem.body = body"类似于:ActiveSheet.PasteAsImage,但它不起作用。

I tried to insert on "theMailItem.body = body" something like: ActiveSheet.PasteAsImage but it didn't work.

    Sub email()

' copy and create a new email

    Range("B2:E21").Select
    Selection.Copy

 Dim theApp, theMailItem, MessageBody, subject
    
     'create a new Outlook Application Object,
     'create a new Mail Item
     Set mail = CreateObject("Outlook.Application")
     Set theMailItem = mail.CreateItem(olMailItem)
     theMailItem.Display
      
     'add recipients to MailItem
     theMailItem.subject = "Pre Alert"
     theMailItem.body = body
End Sub

谢谢!

最好的问候,

Caio

推荐答案

嗨Caio,

Hi Caio,

您可以使用
CopyPicture
将范围复制为图片。邮件正文存储在
WordEditor
邮件的检查员。您可以尝试访问WordEditor,然后将图片粘贴到正文中。

You could use CopyPicture to copy the range as picture. The mail body is stored in WordEditor of the mail's inspector. You could try to access the WordEditor and then paste the picture to the body.

以下是示例。

     Range("B2:E21").Select
     Selection.CopyPicture xlScreen, xlPicture
     'create a new Outlook Application Object,
     'create a new Mail Item
     Set mail = CreateObject("Outlook.Application")
     Set theMailItem = mail.CreateItem(olMailItem)
     theMailItem.Display
     'add recipients to MailItem
     theMailItem.Subject = "Pre Alert"
     Set ins = theMailItem.GetInspector
     'need add reference to Microsoft Word Object Library
     Dim doc As Word.Document
     Set doc = ins.WordEditor
     doc.Select
     doc.Application.Selection.Paste

最好的问候,

Terry


这篇关于从Excel复制并粘贴Outlook作为图像 - VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆