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

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

问题描述

我已经使用自动化将值插入一个细胞,但是我从来没有见过的任何文件,例如,表现出比插入文本和/或公式的任何其他。

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


解决方案

 昏暗的文件名作为字符串
文件名=C:\\ text.jpg
设置NewPic = ActiveSheet.Pictures.Insert(文件名)
NewPic.top = 100
NewPic.left = 100

如果要放置图片的特定单元格,然后选择该单元格为一个范围和使用范围的顶部/左/与定位的图片。

样品: http://exceltip.com/st/Insert_pictures_using_VBA_in_Microsoft_Excel/486.html

注意:在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.

Samples: http://exceltip.com/st/Insert_pictures_using_VBA_in_Microsoft_Excel/486.html

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天全站免登陆