excel中关于图片放大的VBA
发布网友
发布时间:2022-05-08 09:50
我来回答
共2个回答
热心网友
时间:2024-01-21 23:26
Const beishu = 2 '在这里调整放大倍数,当前为2倍
Sub ZhaoPian()
Dim target, sht, rn, mypath, shp, i
For Each shp In Sheets(1).Shapes
shp.OnAction = "ActionClick"
Next
End Sub
Sub ActionClick()
Static n, x
Application.ScreenUpdating = False
If x = Application.Caller Then
n = n + 1
If (n Mod 2) = 1 Then
With Sheet1.Shapes(Application.Caller)
.ScaleHeight beishu, msoFalse, msoScaleFromTopLeft
.ScaleWidth beishu, msoFalse, msoScaleFromTopLeft
.ZOrder msoBringToFront
End With
Else
With Sheet1.Shapes(Application.Caller)
.ScaleHeight 1 / beishu, msoFalse, msoScaleFromTopLeft
.ScaleWidth 1 / beishu, msoFalse, msoScaleFromTopLeft
.ZOrder msoBringToFront
End With
End If
Else
If (n Mod 2) = 1 Then
With Sheet1.Shapes(x)
.ScaleHeight 1 / beishu, msoFalse, msoScaleFromTopLeft
.ScaleWidth 1 / beishu, msoFalse, msoScaleFromTopLeft
.ZOrder msoBringToFront
End With
With Sheet1.Shapes(Application.Caller)
.ScaleHeight beishu, msoFalse, msoScaleFromTopLeft
.ScaleWidth beishu, msoFalse, msoScaleFromTopLeft
.ZOrder msoBringToFront
End With
Else
With Sheet1.Shapes(Application.Caller)
.ScaleHeight beishu, msoFalse, msoScaleFromTopLeft
.ScaleWidth beishu, msoFalse, msoScaleFromTopLeft
.ZOrder msoBringToFront
End With
n = n + 1
End If
x = Application.Caller
End If
Application.ScreenUpdating = True
End Sub
热心网友
时间:2024-01-21 23:26
.ScaleHeight 2, msoFalse, msoScaleFromTopLeft
.ScaleWidth 2, msoFalse, msoScaleFromTopLeft
修改 2 看看?0.5也一样。修改试试。