Problems with an Addin

G

Gil_H

Hi EV1,
I've created an addin and it worked just fine.
Then i inserted a new class (Event Handler) to my project, and created
the addin again.
( Till then, the Auto_Open worked just fine )
After i did it, i couldn't load that addin to any computer !!!
When i had that addin it appears on the addin list, but won't open, and
it ain't listed in Tools --> Customize --> Toolbars.
I'm lost! can anyone please help me?

Thanx,

Gil H.
 
S

Shyam Pillai

Very hard to diagnose a problem without the code. Run the code before
compiling the add-in and confirm that all works well. Also, run the code on
the computer on which it fails before compiling the add-in. Check the macro
security level? If it is High it will not load the add-in anyways. Which
version of PowerPoint are you trying the code against? What kind of an
add-in is it? The regular PowerPoint add-in (*.ppa) or the COM add-in.

--
Regards,
Shyam Pillai

Toolbox
http://skp.mvps.org/toolbox
 
G

Gil_H

Hi,

I'm trying to run the addin in the same computer it has run before, so
security level and versions are not involved.

There are no errors on code, it compiles good.
It is a PPA addin.

What else should i do?

Gil H.
 
S

Steve Rindsberg

Hi,

I'm trying to run the addin in the same computer it has run before, so
security level and versions are not involved.

There are no errors on code, it compiles good.
It is a PPA addin.

What else should i do?

If you have On Error Resume Next anywhere in the code, comment it out, as it
may be masking errors. Then try running the code.

Post the relevant code here if possible.
 
G

Gil_H

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 Auto_Open()
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
 
S

Steve Rindsberg

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.

Have you set breakpoints and traced the code while it's executing?
And what's the exact error message?

But first, see the comment below:
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

**********************************************************************************

' Errors here, perhaps?
' Your Button variables in Module8 are not declared public, so they'd be out of scope
(ie, unavailable) relative to this subroutine, no?

Why not use:

Application.CommandBars("Gils Package").Controls("Picture From File Copier").Enabled
= True

(or false) instead?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top