将图像嵌入Excel电子表格 - VBA [英] Embed Image to Excel Spreadsheet - VBA

查看:123
本文介绍了将图像嵌入Excel电子表格 - VBA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过Excel VBA将图像嵌入到电子表格中,以便每当我重新安置我的excel文件时,图像仍然会显示出来。我该怎么做?

I need to embed an image to a spreadsheet via Excel VBA, such that whenever I relocate my excel file, the image will still show up. How can I do this?

推荐答案

此代码将在当前工作表上插入一个图像,并将其放在单元格E10上: / p>

This code will insert an image on the current sheet and position it at at cell E10:

Set oPic = Application.ActiveSheet.Shapes.AddPicture("d:\temp\mypic.jpg", False, True, 1, 1, 1, 1)
oPic.ScaleHeight 1, True
oPic.ScaleWidth 1, True

oPic.Top = Range("E10").Top
oPic.Left = Range("E10").Left

这篇关于将图像嵌入Excel电子表格 - VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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