我正在尝试去链接的图片从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
发布于 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
复制相似问题