我正在尝试去链接的图片从excel工作表使用vba,但找不到一个解决方案。
找到下面的链接,但它用于形状和图表,不能与作为链接插入的图片一起使用:-
http://answers.microsoft.com/en-us/office/forum/office_2010-word/convert-linked-excel-charts-to-embedded-ones/357bb64d-b852-4e43-8671-b0f49f0dabc3
发布于 2015-05-03 04:41:14
图像仍然是一种形状。分享你的代码,因为你可能遗漏了一个错误。如果这是一个带有HyperLink的简单图像,那么可以试试这个
ActiveSheet.Shapes.Range(Array("Picture 1")).ShapeRange.Item(1).Hyperlink.Delete否则,请执行以下操作-转到“开发人员”选项卡并单击“记录宏”。接下来,手动从图像中删除超级链接,然后通过再次单击停止记录宏。然后转到VBA项目并查看删除超级链接的结果代码。
发布于 2016-02-06 02:11:36
这里有4种不同的工作方式,没有一种是完美的,所以在调试模式下试试吧
err.clear
on error resume next 'everything not working will throw an Error
with activesheet.shapes("Picture 1")
.type=13 'forcfully changing the type form a linketype to normal picture, might not work
.linkformat.autoupdate = false 'might not work
.hyperlink = false 'might not work
.formula = VbNullString 'might not work
'if all fails try the last hope (copy it but no link)
.copy 'if fails : ActiveSheet.Pictures.Paste link:=True
'activesheet.Pictures.Paste link:=True 'failed (works only for picture copy of ranges ?)
ActiveSheet.PasteSpecial Format:="Picture (Enhanced Metafile)"
'you can save .top and .left in a single variable and replace the new pic on the right place
Dim X as single, Y as Single
X=.left
Y=.top
with activesheet.shapes(activesheet.shapes.count) 'the new pic is the last in shapes collection
'same result but i like it less, with : selection.shaperange.item(1) ' you need to be in the picture's sheet, wich in our case is ok because we work on activesheet
.top=Y
.left=X
.name = "Picture 1"
End with
.delete 'removes the old picture
End Withhttps://stackoverflow.com/questions/30006983
复制相似问题