Sub 图片旋转任意角度()
Dim sha As Shape, isa As InlineShape
Static s As Integer
Application.ScreenUpdating = 0
s = InputBox("请输入要旋转的角度:", "图像旋转", s)
If ActiveDocument.Range.InlineShapes.Count > 0 Then
For n = 1 To ActiveDocument.Range.InlineShapes.Count '还可使用count to 1 step-1和for each
With ActiveDocument.Range.InlineShapes(n).ConvertToShape
.Rotation = s
s = .Rotation
.PictureFormat.Brightness = 0.36 '这两句放于前面会出错,转换inlineshape对象失败
.PictureFormat.Contrast = 0.73
.ConvertToInlineShape
End With
Next
ElseIf ActiveDocument.Shapes.Count > 0 Then
For n = 1 To ActiveDocument.Shapes.Count
ActiveDocument.Shapes(n).LockAspectRatio = msoTrue
ActiveDocument.Shapes(n).PictureFormat.Brightness = 0.36
ActiveDocument.Shapes(n).PictureFormat.Contrast = 0.73
ActiveDocument.Shapes(n).Rotation = s
s = ActiveDocument.Shapes(n).Rotation
Next
End If
TT:
If Err.Number > 0 Then ActiveDocument.Undo 1
Application.ScreenUpdating = 1
End Sub