是否可以通过 COM 将图像插入到 Excel 单元格中? [英] Is is possible to insert an image into an excel cell via COM?
问题描述
我已经使用自动化将值插入到单元格中,但是我从未见过任何文档,例如,演示插入文本和/或公式以外的任何内容.
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: ext.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屋!