Excel:将预览悬停在excel图像链接上-后续 [英] Excel: hover preview over excel image link - Follow Up

查看:169
本文介绍了Excel:将预览悬停在excel图像链接上-后续的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将预览悬停在excel图像链接上

大家好-这是另一个问题的跟进问题.对于多个URL提出的解决方案对我不起作用:它只是无限期地创建屏幕截图.我应该修复什么,以便它仅创建一个并让我使用另一个RESET功能删除屏幕截图?

Hi, All - this is a follow up question on this other question. Proposed solution for multiple URL is not working for me: it just keeps creating screenshots indefinitely. What should I fix so that it only creates one and let me use the other RESET function to remove screenshot?

请帮助! @ user1274820 https://stackoverflow.com/users/1274820/user1274820

Help please! @user1274820 https://stackoverflow.com/users/1274820/user1274820

示例文件 https://wetransfer.com/downloads/e1478c699e43f1618879468e50006dc120190917130518/74fc7a

Dim DoOnce As Boolean
Public Function OnMouseOver(URL As String, TheCell As Range)
Reset
If Not DoOnce Then
    DoOnce = True
    With ActiveSheet.Pictures.Insert(URL)
        With .ShapeRange
            .LockAspectRatio = msoTrue
            .Width = 300
            .Height = 200
        End With
        .Left = Cells(TheCell.Row, TheCell.Column + 1).Left
        .Top = Cells(TheCell.Row, TheCell.Column + 1).Top
        .Placement = 1
        .PrintObject = True
    End With
End If
End Function

Public Function Reset()
If DoOnce Then
    DoOnce = False
    ActiveSheet.Pictures.Delete
End If
End Function

推荐答案

尝试一下.直接复制:

Dim DoOnce As Boolean

Public Function OnMouseOver(URL As String, TheCell As Range)
Reset
If Not DoOnce Then
    DoOnce = True
    With ActiveSheet.Pictures.Insert(URL)
        With .ShapeRange
            .LockAspectRatio = msoTrue
            .Width = 300
            .Height = 200
        End With
        .Left = Cells(TheCell.Row, TheCell.Column + 1).Left
        .Top = Cells(TheCell.Row, TheCell.Column + 1).Top
        .Placement = 1
        .PrintObject = True
    End With
End If
End Function

Public Function Reset()
If DoOnce Then
    DoOnce = False
    ActiveSheet.Pictures.Delete
End If
End Function

因此,在工作簿的A列中,将文件的路径(可以是本地路径或URL)放置在B列中的=HIPERLINK(OnMouseOver(A2;E2);"Link")(即用于第2行,但可以将其向下拖动)和C列中放置=HIPERLINK(Reset();"Del").因此,当您将鼠标放在A和B列的顶部时,图像将显示在E列上,并且只需将光标放在C列上,就可以从屏幕上删除它们.

So in your Workbook, column A, place the route of your file (can be local or URL), on column B place =HIPERLINK(OnMouseOver(A2;E2);"Link") (That is for row 2, but you can drag it down) and in column C place =HIPERLINK(Reset();"Del"). So the images will appear on column E when you place your mouse on top of columns A and B and you can delete them from the screen just placing your cursor on column C.

希望有帮助.

这篇关于Excel:将预览悬停在excel图像链接上-后续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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