excelperfect
Sub LoopThroughImages()
Dim shp As Shape
Dim ws As Worksheet
Set ws = ActiveSheet
For Each shp In ws.Shapes
If shp.Type = msoPicture Then
MsgBox shp.Name & '是一幅图片'
End If
Next shp
End Sub
Sub CheckIfPicture()
Dim obj As Object
Set obj = Selection
If TypeName(obj) = 'Picture' Then
MsgBox '所选的是图片'
Else
MsgBox '所选的不是图片'
End If
End Sub
Sub MakeImageLinkedPicture()
Dim ws As Worksheet
Set ws = ActiveSheet
ws.Pictures('Picture 6').Formula = '=C2:E9'
End Sub
Sub ImagePlacementAndLocking()
Dim myImage As Shape
Dim ws As Worksheet
Set ws = ActiveSheet
Set myImage = ws.Shapes('Picture 6')
'图片放置选项
myImage.Placement = xlFreeFloating
'锁定图片(在工作表保护时阻止编辑)
myImage.Locked = True
End Sub
Sub RotateImageIncremental()
Dim myImage As Shape
Dim rotationValue As Integer
Set myImage = ActiveSheet.Shapes('Picture 6')
rotationValue = 45
myImage.IncrementRotation (rotationValue)
End Sub
Sub RotateImageAbsolute()
Dim myImage As Shape
Dim rotationValue As Integer
Set myImage = ActiveSheet.Shapes('Picture 6')
rotationValue = 120
myImage.Rotation = rotationValue
End Sub
联系客服