微软专家John H和 Reiher Jr写了一个PPT插件,允许你围绕X、Y、Z轴的任何一轴自由旋转。
这是一个免费插件,没有实现“动画旋转”功能,不知道其他人是否有完整功能的版本。有的话拿出来分享一下。
把插件的代码也一并公布了吧:
这是窗体代码:
' Rotate Me PPTVB project
' By John H. Reiher Jr.
' Define default axis variables, to store initial X,Y positions
' of the object being rotated.
Dim defX As Integer
Dim defY As Integer
Dim defZ As Integer
Dim objName As String
' Define variables used for rotation
Dim newX As Integer
Dim newY As Integer
Dim newZ As Integer
' Define variables used in error checking
Dim lastX As Integer
Dim lastY As Integer
Dim lastZ As Integer
Private Sub Cancelbut_Click()
' Reset object back to original X-Y-Z coords'
' unload VBapp.
ActiveWindow.Selection.ShapeRange.ThreeD.RotationX = defX
ActiveWindow.Selection.ShapeRange.ThreeD.RotationY = defY
ActiveWindow.Selection.ShapeRange.Rotation = defZ
Unload Me
End Sub
Private Sub cmdReset_Click()
' Reset object back to original X-Y-Z coords'
' Set axis text boxes to original values.
If chkFancy.Value = True Then
newX = Xaxis.Value
newY = Yaxis.Value
newZ = Zaxis.Value
FancyRot defX, defY, defZ
Else
ActiveWindow.Selection.ShapeRange.ThreeD.RotationX = defX
ActiveWindow.Selection.ShapeRange.ThreeD.RotationY = defY
ActiveWindow.Selection.ShapeRange.Rotation = defZ
End If
cmdReset.Enabled = False
Xaxis.Value = defX
Yaxis.Value = defY
Zaxis.Value = defZ
End Sub
Private Sub OKbut_Click()
' run RotMe subroutine, unload program.
RotMe
Unload Me
End Sub
Private Sub preview_Click()
' Run RotMe so user can see if rotation is acceptable.
RotMe
cmdReset.Enabled = True
End Sub
Private Sub SpinButton1_SpinDown()
' nudge down Y axis value. Check for bounds.
Yaxis.Value = Yaxis.Value - SpinButton1.SmallChange
If Yaxis.Value < -90 Then
Yaxis.Value = -90
End If
End Sub
Private Sub SpinButton1_SpinUp()
' nudge up Y axis value. Check for bounds.
Yaxis.Value = Yaxis.Value + SpinButton1.SmallChange
If Yaxis.Value > 90 Then
Yaxis.Value = 90
End If
End Sub
Private Sub SpinButton2_SpinDown()
' nudge down X axis value. Check for bounds.
Xaxis.Value = Xaxis.Value - SpinButton2.SmallChange
If Xaxis.Value < -90 Then
Xaxis.Value = -90
End If
End Sub
Private Sub SpinButton2_SpinUp()
' nudge up X axis value. Check for bounds.
Xaxis.Value = Xaxis.Value + SpinButton2.SmallChange
If Xaxis.Value > 90 Then
Xaxis.Value = 90
End If
End Sub
Private Sub SpinButton3_SpinDown()
' nudge down Z axis value. Check for bounds.
Zaxis.Value = Zaxis.Value - SpinButton3.SmallChange
End Sub
Private Sub SpinButton3_SpinUp()
' nudge up Z axis value. Check for bounds.
Zaxis.Value = Zaxis.Value + SpinButton3.SmallChange
End Sub
Private Sub UserForm_Activate()
' grab X, Y, Z axis coords for object
' set text boxes to same numbers
' set reserved variables.
defX = ActiveWindow.Selection.ShapeRange.ThreeD.RotationX
defY = ActiveWindow.Selection.ShapeRange.ThreeD.RotationY
If ActiveWindow.Selection.ShapeRange.Rotation > 180 Then
defZ = ActiveWindow.Selection.ShapeRange.Rotation - 360
Else
defZ = ActiveWindow.Selection.ShapeRange.Rotation
End If
Xaxis.Value = defX
Yaxis.Value = defY
Zaxis.Value = defZ
lastX = defX
lastY = defY
lastZ = defZ
objName = ActiveWindow.Selection.ShapeRange.Name
cmdReset.Enabled = False
End Sub
Function RotMe()
Dim x As Integer
Dim y As Integer
Dim z As Integer
Dim i As Integer
Dim k As Integer
' Is it Blank?
' yes, set to zero
' else set to axis value.
On Error Resume Next
Err.Clear
If Xaxis.Value = "" Then
x = 0
Xaxis.Value = x
Else
x = Xaxis.Value
End If
If Yaxis.Value = "" Then
y = 0
Yaxis.Value = y
Else
y = Yaxis.Value
End If
If Zaxis.Value = "" Then
z = 0
Zaxis.Value = z
Else
z = Zaxis.Value
End If
If Err.Number <> 0 Then
MsgBox "Please enter a value between -90 and +90"
Xaxis.Value = lastX
Yaxis.Value = lastY
Zaxis.Value = lastZ
Else
' Is it bigger than 90?
' yes, then set it to 90
' no is it less than -90
' yes then set it to -90
If Xaxis.Value > 90 Then
x = 90
Xaxis.Value = x
Else
If Xaxis.Value < -90 Then
x = -90
Xaxis.Value = x
End If
End If
If Yaxis.Value > 90 Then
y = 90
Yaxis.Value = y
Else
If Yaxis.Value < -90 Then
y = -90
Yaxis.Value = y
End If
End If
If Zaxis.Value > 360 Then
z = Zaxis.Value - 360
Zaxis.Value = z
Else
If Zaxis.Value < -360 Then
z = Zaxis.Value + 360
Zaxis.Value = z
End If
End If
' set axis to new location.
If chkFancy.Value = True Then
newX = ActiveWindow.Selection.ShapeRange.ThreeD.RotationX
newY = ActiveWindow.Selection.ShapeRange.ThreeD.RotationY
If ActiveWindow.Selection.ShapeRange.Rotation = lastZ Then
newZ = ActiveWindow.Selection.ShapeRange.Rotation
Else
newZ = lastZ
End If
FancyRot x, y, z
Else
ActiveWindow.Selection.ShapeRange.ThreeD.RotationY = y
ActiveWindow.Selection.ShapeRange.ThreeD.RotationX = x
ActiveWindow.Selection.ShapeRange.Rotation = z
End If
lastX = x
lastY = y
lastZ = z
End If
End Function
Function FancyRot(x As Integer, y As Integer, z As Integer)
Dim Ix As Integer
Dim Iy As Integer
Dim Iz As Integer
Dim Kx As Integer
Dim Ky As Integer
Dim Kz As Integer
If newX >= x Then
Kx = -1
Else
Kx = 1
End If
If newY >= y Then
Ky = -1
Else
Ky = 1
End If
If newZ >= z Then
Kz = -1
Else
Kz = 1
End If
For Iy = newY To y Step Ky
ActiveWindow.Selection.SlideRange.Shapes(objName).Select
ActiveWindow.Selection.ShapeRange.ThreeD.RotationY = Iy
ActiveWindow.Selection.Unselect
Next Iy
For Ix = newX To x Step Kx
ActiveWindow.Selection.SlideRange.Shapes(objName).Select
ActiveWindow.Selection.ShapeRange.ThreeD.RotationX = Ix
ActiveWindow.Selection.Unselect
Next Ix
For Iz = newZ To z Step Kz
ActiveWindow.Selection.SlideRange.Shapes(objName).Select
ActiveWindow.Selection.ShapeRange.Rotation = Iz
ActiveWindow.Selection.Unselect
Next Iz
ActiveWindow.Selection.SlideRange.Shapes(objName).Select
End Function
[ 本帖最后由 无极 于 2008-5-29 09:58 编辑 ]
(23.8 KB, 下载次数: 1737)
Sub LaunchRot()
On Error Resume Next
Err.Clear
Dim not3d As Boolean
'Tests to see if the object selected is a shape
If ActiveWindow.Selection.Type = ppSelectionShapes Then
' Check if error occured
If Err.Number <> 0 Then
MsgBox "3-D Rotation requires that you have a " _
& "presentation open. Open a presentation, select " _
& "a 3-D object and run 3-D Rotation " _
& "again.", vbExclamation, "3-D Rotation Error"
End
End If
'Make sure that only one shape is selected.
If ActiveWindow.Selection.ShapeRange.Count > 1 Then
MsgBox "You have too many objects selected. 3-D Rotation " _
& Chr(13) & "requires that you have one 3-D object selected. To " _
& Chr(13) & "rotate more than one object at a time, use PowerPoint's " _
& Chr(13) & "group command first.", vbExclamation, "3-D Rotation Error"
'Stop the macro.
End
End If
' tests to see if the object selected is a three-d shape
If ActiveWindow.Selection.ShapeRange.ThreeD.Visible = msoTrue Then
' Set the dialog position
frmRotMe.Top = ((Application.Height \ 2) - (frmRotMe.Height \ 2))
frmRotMe.Left = ((Application.Width \ 2) - (frmRotMe.Width \ 2))
frmRotMe.Show
Else
not3d = True
End If
Else
not3d = True
End If
If not3d Then
MsgBox "Please choose a 3D object first.", _
vbExclamation, "No 3D Object Selected"
End If
End Sub
Sub Auto_Open()
' Store an object reference to a command bar
Dim ToolsMenu As CommandBars
' Holds a reference to the new menu item
Dim NewControl As CommandBarControl
' Store the position of the control bar
Dim lPosition As Long
Dim FoundFancy As Boolean
' Counter
Dim x As Long
FoundFancy = False
' Figure out where to place the menu choice
Set ToolsMenu = Application.CommandBars
' Loop through the command bars
For x = 1 To ToolsMenu("Tools").Controls.Count
With ToolsMenu("Tools").Controls.Item(x)
' Check Fancy rotation is in the menus
If .Caption = "&3-D Rotation..." Then
' Fancy rotation was found in the menu
FoundFancy = True
If .OnAction = "LaunchRot" Then
Exit For
Else
.OnAction = "LaunchRot"
Exit For
End If
End If
' Add the menu choice after auto clipart
If .Caption = "A&utoClipArt..." Then
Position = x + 1
Exit For
End If
End With
Next x
' If Auto ClipArt not found put the menu
' sixth in the list
If FoundFancy = False And Position = 0 Then
Position = 6
End If
If FoundFancy <> True And Position <> 0 Then
' Create the menu choice
Set NewControl = ToolsMenu("Tools").Controls.Add _
(Type:=msoControlButton, _
Before:=Position)
' Name the menu item
NewControl.Caption = "&3-D Rotation..."
' Conect the menu choice to the macro
NewControl.OnAction = "LaunchRot"
End If
End Sub
Sub Auto_Close()
On Error Resume Next
' Counter
Dim x As Long
' Store an object reference to a command bar
Dim ToolsMenu As CommandBars
' Figure out where to place the menu choice
Set ToolsMenu = Application.CommandBars
' Loop through the command bars
For x = 1 To ToolsMenu("Tools").Controls.Count
With ToolsMenu("Tools").Controls.Item(x)
' Check Fancy rotation is in the menus
If .Caption = "&3-D Rotation..." Then
' Remove the menu choice
.Delete
End If
End With
Next x
End Sub
在幻灯片上添加一个图形,设置它的三维效果,然后从“工具”菜单中选择“3-D旋转”,就会出现3D旋转窗体,单击窗体上的旋钮就可以改变角度,并可随机预览效果。
请问楼主是怎么回事,俺是新手,请不要见怪
拒绝的权限
QUOTE:
我也是这样的提示,不知为何原因