复制Excel单元格并粘贴到Word中作为图像 [英] Copy Excel Cells and Paste into Word as an Image

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

问题描述

我正在尝试捕获一系列单元格的图像。该图像可以保存或粘贴到相同的excel文档中,粘贴到单词文档等中。我只需要从一组单元格生成图像。

I'm trying to capture an image of a range of cells. This image can either be saved, or pasted into the same excel document, pasted into a word document, etc. I just need to generate images from a groups of cells.

我以为我已经通过复制和粘贴到这个文字来解决了这个问题:

I thought I had figured it out by copying and pasting into word with this:

Dim objWord, objDoc As Object
ActiveWindow.View = xlNormalView
Range("A1:B45").Select
Selection.Copy
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add
objWord.Visible = True
objWord.Selection.PasteSpecial Link:=False, DataType:=wdPasteMetafilePicture, _
    Placement:=wdInLine, DisplayAsIcon:=False
objWord.Selection.TypeParagraph

当我运行它,它似乎工作。但是用粘贴的对象实际上是一个像元文件一样的电子表格对象。 (所以它将数据作为一个嵌入式excel表)。

When I run this, it seems to work. But the object that's pasted in word is actually a spreadsheet object that acts like a metafile. (So it's bringing the data along with it as an embedded excel sheet).

任何建议?

推荐答案

这似乎起作用:

Sub luxation()
    Dim objWord, objDoc As Object
    ActiveWindow.View = xlNormalView
    Range("A1:B45").Select
    Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
    Set objWord = CreateObject("Word.Application")
    Set objDoc = objWord.Documents.Add
    objWord.Visible = True
    objWord.Selection.Paste
    objWord.Selection.TypeParagraph
End Sub

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

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