【问题标题】:Inserted Picture is referenced instead of inserted when using VBA Picture.insert(path)使用 VBA Picture.insert(path) 时引用插入的图片而不是插入的图片
【发布时间】:2017-12-15 08:26:37
【问题描述】:

我使用以下代码将徽标插入到 Excel 图表中:

ActiveChart.Pictures.Insert("path\logo.jpg").Select

我看到了徽标,从我的角度来看,一切都很好。但是,如果我通过电子邮件将此文件发送给无法访问路径的同事,他就看不到图片。从这个证据我得出结论,代码引用了图片而不是插入它。

如何永久插入图片,即使路径不再可访问,徽标仍可见?

【问题讨论】:

  • 你使用的路径是绝对路径,意思是像“C:/User/Pictures/...”这样的吗?

标签: vba excel


【解决方案1】:

要将图像嵌入文件中,您必须添加一个形状,然后使用 AddPicture 将图像放入该形状中

Application.ActiveSheet.Shapes.AddPicture "C:\documents\somepicture.jpg", False, True, 1, 1, 100, 100

这个例子来自here

MSDN也有一些资料here

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2021-12-29
  • 2020-07-02
  • 2013-05-11
  • 1970-01-01
  • 1970-01-01
  • 2021-04-19
  • 2018-05-28
  • 1970-01-01
相关资源
最近更新 更多