excel - Excel VBA 自动功能重置/图像加载
问题描述
我正在使用函数 OnMouseOver 根据单元格中的文本加载特定图片。
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 = 300
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
我的问题是我必须使用“重置”功能来删除加载的图片。所以我必须将鼠标移动到下一个单元格,并具有删除图片的功能。是否可以修改仅当鼠标悬停在单元格上时才显示图片的功能?
解决方案
推荐阅读
- python-3.x - 熊猫识别当前日期,并过滤相对于今天日期的日期列
- python - 如何让 df.loc 从数据帧的特定单元格返回值(数字)?
- python - 使用来自 CSV 的输入从 Python 运行动态查询
- javascript - 如何向位于数据数组内的图像添加超链接?
- c++ - 虚幻引擎 C++ UPaperSprite 数组?
- jenkins - 将新标签添加到远程分支时如何自动触发 Jenkins 作业
- reactjs - 这是 React useImperativeHandle 钩子的正确用例吗?
- sorting - 如何修复 MIPS 程序集中的错误地址错误
- java - 如何合并和打印两个排序的整数数组
- php - 如何将保存名称从“Post-id”更改为增加数字 1,2,3+....?