A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Powerpoint
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Problems with an Addin



 
 
Thread Tools Display Modes
  #1  
Old October 15th, 2006, 09:31 AM posted to microsoft.public.powerpoint
Gil_H
external usenet poster
 
Posts: 29
Default Problems with an Addin

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.

  #2  
Old October 15th, 2006, 03:16 PM posted to microsoft.public.powerpoint
Shyam Pillai
external usenet poster
 
Posts: 622
Default Problems with an Addin

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



"Gil_H" wrote in message
oups.com...
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.



  #3  
Old October 15th, 2006, 04:19 PM posted to microsoft.public.powerpoint
Gil_H
external usenet poster
 
Posts: 29
Default Problems with an Addin

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.

  #4  
Old October 15th, 2006, 05:58 PM posted to microsoft.public.powerpoint
Steve Rindsberg
external usenet poster
 
Posts: 9,366
Default Problems with an Addin

In article . com, Gil_H wrote:
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.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


  #5  
Old October 15th, 2006, 06:17 PM posted to microsoft.public.powerpoint
Gil_H
external usenet poster
 
Posts: 29
Default Problems with an Addin

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.SlideInde x
With ActivePresentation.Slides(CurrentSlide).TimeLine
For i = 1 To .MainSequence.Count
If .MainSequence(i).Shape.Name = Tmp Then
EffectTypeStr =
Module3.GetMSOAnimEffect(.MainSequence(i).EffectTy pe)
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

  #6  
Old October 15th, 2006, 11:58 PM posted to microsoft.public.powerpoint
Steve Rindsberg
external usenet poster
 
Posts: 9,366
Default Problems with an Addin

In article . com, Gil_H wrote:
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?

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.SlideInde x
With ActivePresentation.Slides(CurrentSlide).TimeLine
For i = 1 To .MainSequence.Count
If .MainSequence(i).Shape.Name = Tmp Then
EffectTypeStr =
Module3.GetMSOAnimEffect(.MainSequence(i).EffectTy pe)
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


-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:00 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.