将图像从剪贴板粘贴到Excel中的单元格 [英] Paste an image from clipboard to a cell in Excel

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

问题描述

我想使用vba将剪贴板中的图像粘贴到Excel单元格中.我可以找到这样的代码:

I want to paste an image from clipboard to an excel cell using vba. i could find a code like this :

If My.Computer.Clipboard.ContainsImage() Then
Dim grabpicture = My.Computer.Clipboard.GetImage()
PictureBox1.Image = grabpicture
End If

但是这里的grabpicture变量是一个对象.如何从图像对象更新单元格.像这样

but here grabpicture variable is an object. how to update a cell from an image object. like this,

Sheet1.Range("D11").Value = grabpicture

推荐答案

图片未插入到单元格中.将图片插入到工作表上,然后将其对齐,以使左上角在视觉上与某个单元格的左上角相匹配.

Pictures are not inserted into cells. Pictures are inserted onto the sheet and then may be aligned so that the top left corner visually matches top left corner of some cell.

要从剪贴板插入图片,请使用 Sheet1.Paste().

To insert a picture from the clipboard, you use Sheet1.Paste().

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

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