是否可以通过COM将图像插入Excel单元格? [英] Is is possible to insert an image into an excel cell via COM?

查看:235
本文介绍了是否可以通过COM将图像插入Excel单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用自动化将值插入单元格,但我从未见过任何文档,例如,演示了插入任何文本和/或公式之外的任何东西。

I have used automation to insert values into a cell, however I have never seen any documentation, for example, that demonstrate inserting anything other than text and/or formula's.

有人能够从外部应用程序插入图片吗?

Has anybody been able to insert an image from an external application?

推荐答案

Dim FileName as string
FileName="c:\text.jpg"
Set NewPic = ActiveSheet.Pictures.Insert(FileName)
NewPic.top=100
NewPic.left=100

如果要将图片放置到特定单元格,请选择该单元格作为范围,

If you want to position the picture to a specific cell then select that cell as a range and use that ranges top/left/with to position the picture.

范例: http://exceltip.com/st/Insert_pictures_using_VBA_in_Microsoft_Excel/486.html

请注意:在Excel单元格中不能包含图片。图片生活在一个看不见的绘图层,浮在细胞周围。它们可以基于细胞坐标定位,这使得它们感觉他们生活在细胞中。

Note: In Excel cells cannot contain pictures. The pictures live on an invisible drawing layer that floats about the cells. They can be positioned based on the cell coordinates, which makes it feel like they are living "in" the cells.

这篇关于是否可以通过COM将图像插入Excel单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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