首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >取消链接图片超链接

取消链接图片超链接
EN

Stack Overflow用户
提问于 2015-05-03 04:14:41
回答 2查看 3.3K关注 0票数 3

我正在尝试去链接的图片从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

EN

回答 2

Stack Overflow用户

发布于 2015-05-03 04:41:14

图像仍然是一种形状。分享你的代码,因为你可能遗漏了一个错误。如果这是一个带有HyperLink的简单图像,那么可以试试这个

代码语言:javascript
复制
ActiveSheet.Shapes.Range(Array("Picture 1")).ShapeRange.Item(1).Hyperlink.Delete

否则,请执行以下操作-转到“开发人员”选项卡并单击“记录宏”。接下来,手动从图像中删除超级链接,然后通过再次单击停止记录宏。然后转到VBA项目并查看删除超级链接的结果代码。

票数 0
EN

Stack Overflow用户

发布于 2016-02-06 02:11:36

这里有4种不同的工作方式,没有一种是完美的,所以在调试模式下试试吧

代码语言:javascript
复制
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 With
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30006983

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档