vba - Excel中的VBA自动更新图像尺寸
问题描述
编辑:17-07-2018 找到了在 Excel 中检索图像尺寸的解决方案。
我已经创建了一个代码来在 Excel 中检索图像文件并且它工作正常,但是一旦我调整了图像的大小,它就不会自动更新它的值,我需要在之前的图像之间切换,然后返回到调整大小的图像以获取值.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim mypic As Picture
If Target.Address = "$A$4" Then
Me.Pictures.Visible = False
With Range("e2")
For Each mypic In Me.Pictures
If mypic.Name = .Text Then
mypic.Visible = True
mypic.Top = .Top
mypic.Left = .Left
Exit For
End If
Next mypic
End With
With ActiveSheet
s = Round(.Shapes(.Range("e2").Value).Height / 72 * 2.54, 2) & "cm"
y = Round(.Shapes(.Range("e2").Value).Width / 72 * 2.54, 2) & "cm"
MsgBox "Picture dimensions are " & vbLf & vbLf & _
"Height: " & s & vbLf & vbLf & _
"Width: " & y
.Range("Q5") = s
.Range("Q6") = y
End With
End If
End Sub
上面的代码有一种方法可以自动更新值,而无需关闭 Excel 文件或在图像之间切换。
提前谢谢你!
解决方案
推荐阅读
- python-2.7 - Conv1D 和 MaxPooling1D 的输入形状
- flutter - Flutter - 如何填充 Stepper 控件构建器中的剩余空间?
- hyperlink - JIRA 评论中不显示链接别名
- c - 提示用户输入后出现“分段错误(核心转储)”
- python - 如何在给定特定规则的情况下将字符串中的特定字母大写
- javascript - 如何通过拖放上传多个文件并使用ajax浏览
- spring - 无法在服务中启动spring cloud eureka客户端
- reporting-services - 直接在报告上过滤多个值
- sql - 在 PLSQL 中声明一个常量
- c# - 在 Net Framework 4.7.1 上启动 Apache Ignite 2.7 时出现序列化异常