|
前段时间写的一个成品:
- Sub 图像旋转任意角度()
- On Error Resume Next
- Static s As Integer, rg As Range
- Set rg = IIf(Selection.Type = wdSelectionIP, ActiveDocument.Content, Selection.Range) '经典选择语句!!!
- If Selection.Type = wdSelectionIP Then If MsgBox("程序将处理文中所有图片,是否继续?", vbYesNo) = vbNo Then Exit Sub
- s = InputBox("请输入要旋转的角度:", "图像旋转", s)
- For n = 1 To rg.InlineShapes.Count '还可使用count to 1 step-1和for each
- With rg.InlineShapes(n).ConvertToShape
- .Rotation = s
- s = .Rotation
- .ConvertToInlineShape
- End With
- Next
- For n = 1 To rg.ShapeRange.Count
- rg.ShapeRange.LockAspectRatio = msoTrue
- rg.ShapeRange(n).Rotation = s
- s = rg.ShapeRange(n).Rotation
- Next
- End Sub
复制代码 |
|