|
记不清我的代码抄谁的了,不好意思,感谢无名英雄。
我的Word版本是2003版的,Word2003的文本框好像没有绿色的旋转点,我的文本框是从ppt里粘贴过来的。好像粘贴过来的名字就是以"Rectangle 2"开始命名,"Rectangle 3"等,不清楚什么原因。
- Sub 旋转() '文本框的旋转
- For a = 0 To 360 Step 2
- DoEvents
- ActiveDocument.Shapes("Rectangle 2").Select
- Selection.ShapeRange.Rotation = a
- ActiveDocument.Shapes("Rectangle 3").Select
- Selection.ShapeRange.Rotation = -a
- Next
- End Sub
- Private Sub CommandButton1_Click()
- Call 旋转
- End Sub
复制代码 因为前面已经有“2”、“3”命名的文件,所以直线自动以"Line 5"、"Line 6"命名了。我感觉文本框、直线、矩形、椭圆等自选图形与图片虽然名称不一样,但是都属于shaps一类的,代码也应该近似吧。不知道我的理解对否,盼高手指点。
- Sub 旋转2() '直线的旋转
- For a = 360 To 0 Step -5
- DoEvents
- ActiveDocument.Shapes("Line 4").Select
- Selection.ShapeRange.Rotation = a
- ActiveDocument.Shapes("Line 5").Select
- Selection.ShapeRange.Rotation = 2 * a
- Next
- End Sub
- Private Sub CommandButton2_Click()
- Call 旋转2
- End Sub
- '矩形等自选图形应该有很多相似的地方吧
- Sub 旋转3() '矩形的旋转
- For a = 0 To 720 Step 10
- DoEvents
- ActiveDocument.Shapes("Rectangle 6").Select
- Selection.ShapeRange.Rotation = 3 * a
- ActiveDocument.Shapes("Rectangle 7").Select
- Selection.ShapeRange.Rotation = -3 * a
- Next
- End Sub
- Private Sub CommandButton3_Click()
- Call 旋转3
- End Sub
- Private Sub CommandButton4_Click()
- For a = 0 To 360 Step 10
- DoEvents
- ActiveDocument.Shapes("Rectangle 2").Select
- Selection.ShapeRange.Rotation = a
- ActiveDocument.Shapes("Rectangle 3").Select
- Selection.ShapeRange.Rotation = -a
- ActiveDocument.Shapes("Line 4").Select
- Selection.ShapeRange.Rotation = a
- ActiveDocument.Shapes("Line 5").Select
- Selection.ShapeRange.Rotation = 2 * a
- ActiveDocument.Shapes("Rectangle 6").Select
- Selection.ShapeRange.Rotation = 3 * a
- ActiveDocument.Shapes("Rectangle 7").Select
- Selection.ShapeRange.Rotation = -3 * a
- Next
- End Sub
复制代码 总之我是在别人的基础上加工下,这些代码几乎相同,贴出来,害怕同道耻笑,我都想放弃了。但我想像我一样想学的人有很多,盼望热心人的指点。
我记得守柔版的有个遍历自选图形的代码,惭愧,忘记了,没找到。只有一二三四,再来一次,在做一起旋转的时候,把代码再组合一遍。因为每组图形设置的参数不一致,害怕不转,先把参数改统一,看到效果一致,又恢复了原来的参数。虽然一起旋转和分开旋转不能各设各的,只有统一角度了。
请高手指点。
虽然很早就注册了,以前都是偷作品,真正进来学习是今年的四月。聊以自慰!
务请高手多多指点!
|
|