I get an Error of something like: "Compiler: error in class1"
I Compiled it and it gave me no errors, but when i add the addin - the
commandbar opens and when i make a shape selection - i get the error.
Here is the Class1 Code:
Public WithEvents PPTEvent As Application
Dim Tmp As String
Dim MyShapes As Shapes
Dim CurrentSlide As Long
Dim EffectTypeStr As String
Dim i As Integer
Private Sub PPTEvent_WindowSelectionChange(ByVal Sel As Selection)
If Not Sel.Type = ppSelectionNone Then
Tmp = Sel.ShapeRange.Type
Tmp = Left(Tmp, 7)
If Sel.Type = ppSelectionShapes And (Sel.ShapeRange.Type =
msoPicture _
Or Tmp = "Picture") Then
Module8.ButtonPictureFromFile.Enabled = True
Else
Module8.ButtonPictureFromFile.Enabled = False
End If
Tmp = Sel.ShapeRange.Name
If IsShapeMotioned(Tmp) = 1 Then
Module8.ButtonMotionPath.Enabled = True
Else
Module8.ButtonMotionPath.Enabled = False
End If
Else
Module8.ButtonPictureFromFile.Enabled = False
Module8.ButtonMotionPath.Enabled = False
End If
End Sub
Function IsShapeMotioned(Tmp)
IsShapeMotioned = 0
If ActivePresentation.Windows(1).View.Type = ppViewNormal Then
CurrentSlide = ActivePresentation.Windows(1).View.Slide.SlideIndex
With ActivePresentation.Slides(CurrentSlide).TimeLine
For i = 1 To .MainSequence.Count
If .MainSequence(i).Shape.Name = Tmp Then
EffectTypeStr =
Module3.GetMSOAnimEffect(.MainSequence(i).EffectType)
EffectTypeStr = Replace(EffectTypeStr,
"msoAnimEffect", "")
EffectTypeStr = Left(EffectTypeStr, 4)
If (EffectTypeStr = "Path") Then
IsShapeMotioned = 1
End If
End If
Next
End With
End If
End Function
*************************************************************************************
And here is the Module 8 Code:
*************************************************************************************
Dim cPPTObject As New Class1
Dim TrapFlag As Boolean
Public ButtonMotionPath As CommandBarButton
Public ButtonPictureFromFile As CommandBarButton
Sub Aut
pen()
Dim GilToolbar As CommandBar
Dim ButtonShapeList As CommandBarButton
Dim ButtonAnimationList As CommandBarButton
Dim ButtonCopyAnimation As CommandBarButton
Dim ButtonPictureCopy As CommandBarButton
Dim ButtonJoinMotionPaths As CommandBarButton
Dim ButtonMoveTo As CommandBarButton
Dim ButtonShapeToPolygon As CommandBarButton
Dim CurrentSlide As Long
Dim S As Shape
Dim MyShapes As Shapes
Dim MyToolbar As String
MyToolbar = "Gil's Package"
On Error Resume Next
Set GilToolbar = CommandBars.Add(Name:=MyToolbar, _
Position:=msoBarFloating, Temporary:=True)
If Err.Number <> 0 Then
' The toolbar's already there, so we have nothing to do
Exit Sub
End If
On Error GoTo ErrorHandler
Set ButtonShapeList =
GilToolbar.Controls.Add(Type:=msoControlButton)
Set ButtonAnimationList =
GilToolbar.Controls.Add(Type:=msoControlButton)
Set ButtonCopyAnimation =
GilToolbar.Controls.Add(Type:=msoControlButton)
Set ButtonMotionPath =
GilToolbar.Controls.Add(Type:=msoControlButton)
Set ButtonJoinMotionPaths =
GilToolbar.Controls.Add(Type:=msoControlButton)
Set ButtonMoveTo = GilToolbar.Controls.Add(Type:=msoControlButton)
Set ButtonPictureCopy =
GilToolbar.Controls.Add(Type:=msoControlButton)
Set ButtonPictureFromFile =
GilToolbar.Controls.Add(Type:=msoControlButton)
Set ButtonShapeToPolygon =
GilToolbar.Controls.Add(Type:=msoControlButton)
With ButtonShapeList
.DescriptionText = "Shape List"
.Caption = "Shape List"
.OnAction = "ShapeList"
.Style = msoButtonIcon
.FaceId = 7
End With
With ButtonShapeToPolygon
.DescriptionText = "Shape To Polygon"
.Caption = "Convert Shape To Polygon"
.OnAction = "ConvertToPolygon"
.Style = msoButtonIcon
.FaceId = 196
End With
With ButtonAnimationList
.DescriptionText = "Animation List"
.Caption = "Get Shape From Animation List"
.OnAction = "ShapeFromAnimationList"
.Style = msoButtonIcon
.FaceId = 2894
End With
With ButtonCopyAnimation
.DescriptionText = "Copy Animation"
.Caption = "Copy Animation From Shape"
.OnAction = "AnimationList"
.Style = msoButtonIcon
.FaceId = 2896
End With
With ButtonMotionPath
.DescriptionText = "Show Motion Paths And Duplicate At End
Path"
.Caption = "Duplicate At End Path"
.OnAction = "Duplicate"
.Style = msoButtonIcon
.FaceId = 2640
.Enabled = False
End With
With ButtonJoinMotionPaths
.DescriptionText = "Join Motion Paths"
.Caption = "Join Motion Paths"
.OnAction = "InitializeMotion"
.Style = msoButtonIcon
.FaceId = 2091
End With
With ButtonMoveTo
.DescriptionText = "Create Motion Animation To Move To"
.Caption = "Create Motion Animation To Move To Object"
.OnAction = "MoveInitialize"
.Style = msoButtonIcon
.FaceId = 243
End With
With ButtonPictureCopy
.DescriptionText = "Picture Copy"
.Caption = "Copy A Picture Properties"
.OnAction = "PictureCopy"
.Style = msoButtonIcon
.FaceId = 218
End With
With ButtonPictureFromFile
.DescriptionText = "Picture From File Copier"
.Caption = "Replace Picture From File"
.OnAction = "PictureFromFile"
.Style = msoButtonIcon
.FaceId = 1362
.Enabled = False
End With
GilToolbar.Top = 150
GilToolbar.Left = 150
GilToolbar.Visible = True
Set cPPTObject.PPTEvent = Application
NormalExit:
Exit Sub
ErrorHandler:
MsgBox Err.Number & vbCrLf & Err.Description
Resume NormalExit:
End Sub