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  

PowerPoint 2003 AddIns does not work in PowerPoint 2007



 
 
Thread Tools Display Modes
  #1  
Old July 24th, 2008, 04:27 AM posted to microsoft.public.powerpoint
LostMyBrain
external usenet poster
 
Posts: 3
Default PowerPoint 2003 AddIns does not work in PowerPoint 2007

Hi,

I have a simple AddIns for PowerPoint that I wrote and it works fine on
version 2003. However, when trying to run it on 2007 it does not work as
expected.

In order to debug the problem, I removed all the non-relevant code and ended
up with a simple AddIns that open a form with two buttons "OK","Cancel". Once
the user press "OK" it creates a rectangular shape on the current slide and
close the form. As part of the code, this macro attaches a tag to the
rectangular so that when the user double-clicks on this shape it reopen the
form, but this time the buttons are "Work","Cancel".

In both 2003, 2007 the first part works fine and the new rectangular is
added to the slide. However, in 2007 the second part does not work.
Double-clicking the rectangular brings the picture toolbar and does not open
the form as expected. In 2003 it works find.

I can attach my .ppt file (and also the .ppa file) - but I don't see how to
attach files to this question.

Thank you.
  #2  
Old July 24th, 2008, 03:45 PM posted to microsoft.public.powerpoint
Steve Rindsberg
external usenet poster
 
Posts: 9,366
Default PowerPoint 2003 AddIns does not work in PowerPoint 2007

In order to debug the problem, I removed all the non-relevant code and ended
up with a simple AddIns that open a form with two buttons "OK","Cancel". Once
the user press "OK" it creates a rectangular shape on the current slide and
close the form. As part of the code, this macro attaches a tag to the
rectangular so that when the user double-clicks on this shape it reopen the
form, but this time the buttons are "Work","Cancel".

In both 2003, 2007 the first part works fine and the new rectangular is
added to the slide. However, in 2007 the second part does not work.
Double-clicking the rectangular brings the picture toolbar and does not open
the form as expected. In 2003 it works find.

I can attach my .ppt file (and also the .ppa file) - but I don't see how to
attach files to this question.


No need to attach the PPA, just copy and paste the relevant parts of the code
here in the message box.

Particularly, mention how you're trapping the doubleclick on the rectangle.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.com

  #3  
Old July 24th, 2008, 05:01 PM posted to microsoft.public.powerpoint
LostMyBrain
external usenet poster
 
Posts: 3
Default PowerPoint 2003 AddIns does not work in PowerPoint 2007

Hi,

Here it is (using export option)
I attached 3 text files the Macros, MyForm and the section responsible for
trapping the double-click event.

Thanks.

---- Macros ----------------------
Attribute VB_Name = "Macros"
Sub NewTest()
Attribute NewTest.VB_Description = "Macro created 24.5.2007 by Zvika Ben-Haim"
Load MyForm
MyForm.ButtonRun.Caption = "Create"
MyForm.Show
End Sub

Sub Auto_Open()
' Runs when the add-in is loaded
MyForm.InitializeApp
End Sub


---- MyForm ----------------------
VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} MyForm
Caption = "Test"
ClientHeight = 1935
ClientLeft = 45
ClientTop = 330
ClientWidth = 5175
OleObjectBlob = "MyForm.frx":0000
StartUpPosition = 1 'CenterOwner
End
Attribute VB_Name = "MyForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim theAppEventHandler As New appEventHandler

Sub InitializeApp()
' This enables us to capture application events, such as double-clicking
on
' an IguanaTex image
Set theAppEventHandler.App = Application

MenuItemCaption = "New Test..."

' Check if we have already added the menu item
Dim initialized As Boolean
Dim bef As Integer
initialized = False
bef = 1
Dim Menu As CommandBars
Set Menu = Application.CommandBars
For i = 1 To Menu("Insert").Controls.Count
With Menu("Insert").Controls(i)
If .Caption = MenuItemCaption Then
initialized = True
Exit For
ElseIf InStr(.Caption, "Dia&gram") Then
bef = i
End If
End With
Next

' Create the menu choice. The choice is created in the first
' position in the Insert menu.
If Not initialized Then
Dim NewControl As CommandBarControl
Set NewControl = Menu("Insert").Controls.Add _
(Type:=msoControlButton, _
befo=bef)
NewControl.Caption = MenuItemCaption
NewControl.OnAction = "NewTest"
End If
End Sub

Private Sub ButtonCancel_Click()
MyForm.Hide
End Sub

Private Sub ButtonRun_Click()

If ButtonRun.Caption = "Create" Then
Dim newShape As Shape
Set newShape =
ActiveWindow.Selection.SlideRange.Shapes.AddShape( msoShapeRectangle, 5, 25,
100, 50)
newShape.Select
newShape.Tags.Add "MYADDIN", "MyText"
End If

MyForm.Hide
End Sub

---- Trapping the double-click event ----------------------
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "AppEventHandler"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public WithEvents App As Application
Attribute App.VB_VarHelpID = -1

Private Sub App_WindowBeforeDoubleClick(ByVal Sel As Selection, ByRef Cancel
As Boolean)
If Sel.Type = ppSelectionShapes Then
If Sel.ShapeRange.Count = 1 Then
With Sel.ShapeRange.Tags
For i = 1 To .Count
If (.Name(i) = "MYADDIN") Then
Load MyForm
MyForm.ButtonRun.Caption = "Work !!"
MyForm.Show
Cancel = True
Exit Sub
End If
Next
End With
End If
End If
End Sub








"Steve Rindsberg" wrote:

In order to debug the problem, I removed all the non-relevant code and ended
up with a simple AddIns that open a form with two buttons "OK","Cancel". Once
the user press "OK" it creates a rectangular shape on the current slide and
close the form. As part of the code, this macro attaches a tag to the
rectangular so that when the user double-clicks on this shape it reopen the
form, but this time the buttons are "Work","Cancel".

In both 2003, 2007 the first part works fine and the new rectangular is
added to the slide. However, in 2007 the second part does not work.
Double-clicking the rectangular brings the picture toolbar and does not open
the form as expected. In 2003 it works find.

I can attach my .ppt file (and also the .ppa file) - but I don't see how to
attach files to this question.


No need to attach the PPA, just copy and paste the relevant parts of the code
here in the message box.

Particularly, mention how you're trapping the doubleclick on the rectangle.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.com


  #4  
Old July 25th, 2008, 04:19 PM posted to microsoft.public.powerpoint
Shyam Pillai
external usenet poster
 
Posts: 622
Default PowerPoint 2003 AddIns does not work in PowerPoint 2007

WindowBeforeDoubleClick and WindowBeforeRightClick events don't work anymore
on the Slide itself. They work only in other views.

Regards,
Shyam Pillai

Image Importer Wizard
http://skp.mvps.org/iiw.htm

"LostMyBrain" wrote in message
...
Hi,

Here it is (using export option)
I attached 3 text files the Macros, MyForm and the section responsible for
trapping the double-click event.

Thanks.

---- Macros ----------------------
Attribute VB_Name = "Macros"
Sub NewTest()
Attribute NewTest.VB_Description = "Macro created 24.5.2007 by Zvika
Ben-Haim"
Load MyForm
MyForm.ButtonRun.Caption = "Create"
MyForm.Show
End Sub

Sub Auto_Open()
' Runs when the add-in is loaded
MyForm.InitializeApp
End Sub


---- MyForm ----------------------
VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} MyForm
Caption = "Test"
ClientHeight = 1935
ClientLeft = 45
ClientTop = 330
ClientWidth = 5175
OleObjectBlob = "MyForm.frx":0000
StartUpPosition = 1 'CenterOwner
End
Attribute VB_Name = "MyForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim theAppEventHandler As New appEventHandler

Sub InitializeApp()
' This enables us to capture application events, such as
double-clicking
on
' an IguanaTex image
Set theAppEventHandler.App = Application

MenuItemCaption = "New Test..."

' Check if we have already added the menu item
Dim initialized As Boolean
Dim bef As Integer
initialized = False
bef = 1
Dim Menu As CommandBars
Set Menu = Application.CommandBars
For i = 1 To Menu("Insert").Controls.Count
With Menu("Insert").Controls(i)
If .Caption = MenuItemCaption Then
initialized = True
Exit For
ElseIf InStr(.Caption, "Dia&gram") Then
bef = i
End If
End With
Next

' Create the menu choice. The choice is created in the first
' position in the Insert menu.
If Not initialized Then
Dim NewControl As CommandBarControl
Set NewControl = Menu("Insert").Controls.Add _
(Type:=msoControlButton, _
befo=bef)
NewControl.Caption = MenuItemCaption
NewControl.OnAction = "NewTest"
End If
End Sub

Private Sub ButtonCancel_Click()
MyForm.Hide
End Sub

Private Sub ButtonRun_Click()

If ButtonRun.Caption = "Create" Then
Dim newShape As Shape
Set newShape =
ActiveWindow.Selection.SlideRange.Shapes.AddShape( msoShapeRectangle, 5,
25,
100, 50)
newShape.Select
newShape.Tags.Add "MYADDIN", "MyText"
End If

MyForm.Hide
End Sub

---- Trapping the double-click event ----------------------
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "AppEventHandler"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public WithEvents App As Application
Attribute App.VB_VarHelpID = -1

Private Sub App_WindowBeforeDoubleClick(ByVal Sel As Selection, ByRef
Cancel
As Boolean)
If Sel.Type = ppSelectionShapes Then
If Sel.ShapeRange.Count = 1 Then
With Sel.ShapeRange.Tags
For i = 1 To .Count
If (.Name(i) = "MYADDIN") Then
Load MyForm
MyForm.ButtonRun.Caption = "Work !!"
MyForm.Show
Cancel = True
Exit Sub
End If
Next
End With
End If
End If
End Sub








"Steve Rindsberg" wrote:

In order to debug the problem, I removed all the non-relevant code and
ended
up with a simple AddIns that open a form with two buttons
"OK","Cancel". Once
the user press "OK" it creates a rectangular shape on the current slide
and
close the form. As part of the code, this macro attaches a tag to the
rectangular so that when the user double-clicks on this shape it reopen
the
form, but this time the buttons are "Work","Cancel".

In both 2003, 2007 the first part works fine and the new rectangular is
added to the slide. However, in 2007 the second part does not work.
Double-clicking the rectangular brings the picture toolbar and does not
open
the form as expected. In 2003 it works find.

I can attach my .ppt file (and also the .ppa file) - but I don't see
how to
attach files to this question.


No need to attach the PPA, just copy and paste the relevant parts of the
code
here in the message box.

Particularly, mention how you're trapping the doubleclick on the
rectangle.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.com



  #5  
Old July 25th, 2008, 04:32 PM posted to microsoft.public.powerpoint
LostMyBrain
external usenet poster
 
Posts: 3
Default PowerPoint 2003 AddIns does not work in PowerPoint 2007

Can you suggest me how to fix my code for 2007?
Is there any method that will work on both versions as is ?

"Shyam Pillai" wrote:

WindowBeforeDoubleClick and WindowBeforeRightClick events don't work anymore
on the Slide itself. They work only in other views.

Regards,
Shyam Pillai

Image Importer Wizard
http://skp.mvps.org/iiw.htm

"LostMyBrain" wrote in message
...
Hi,

Here it is (using export option)
I attached 3 text files the Macros, MyForm and the section responsible for
trapping the double-click event.

Thanks.

---- Macros ----------------------
Attribute VB_Name = "Macros"
Sub NewTest()
Attribute NewTest.VB_Description = "Macro created 24.5.2007 by Zvika
Ben-Haim"
Load MyForm
MyForm.ButtonRun.Caption = "Create"
MyForm.Show
End Sub

Sub Auto_Open()
' Runs when the add-in is loaded
MyForm.InitializeApp
End Sub


---- MyForm ----------------------
VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} MyForm
Caption = "Test"
ClientHeight = 1935
ClientLeft = 45
ClientTop = 330
ClientWidth = 5175
OleObjectBlob = "MyForm.frx":0000
StartUpPosition = 1 'CenterOwner
End
Attribute VB_Name = "MyForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim theAppEventHandler As New appEventHandler

Sub InitializeApp()
' This enables us to capture application events, such as
double-clicking
on
' an IguanaTex image
Set theAppEventHandler.App = Application

MenuItemCaption = "New Test..."

' Check if we have already added the menu item
Dim initialized As Boolean
Dim bef As Integer
initialized = False
bef = 1
Dim Menu As CommandBars
Set Menu = Application.CommandBars
For i = 1 To Menu("Insert").Controls.Count
With Menu("Insert").Controls(i)
If .Caption = MenuItemCaption Then
initialized = True
Exit For
ElseIf InStr(.Caption, "Dia&gram") Then
bef = i
End If
End With
Next

' Create the menu choice. The choice is created in the first
' position in the Insert menu.
If Not initialized Then
Dim NewControl As CommandBarControl
Set NewControl = Menu("Insert").Controls.Add _
(Type:=msoControlButton, _
befo=bef)
NewControl.Caption = MenuItemCaption
NewControl.OnAction = "NewTest"
End If
End Sub

Private Sub ButtonCancel_Click()
MyForm.Hide
End Sub

Private Sub ButtonRun_Click()

If ButtonRun.Caption = "Create" Then
Dim newShape As Shape
Set newShape =
ActiveWindow.Selection.SlideRange.Shapes.AddShape( msoShapeRectangle, 5,
25,
100, 50)
newShape.Select
newShape.Tags.Add "MYADDIN", "MyText"
End If

MyForm.Hide
End Sub

---- Trapping the double-click event ----------------------
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "AppEventHandler"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public WithEvents App As Application
Attribute App.VB_VarHelpID = -1

Private Sub App_WindowBeforeDoubleClick(ByVal Sel As Selection, ByRef
Cancel
As Boolean)
If Sel.Type = ppSelectionShapes Then
If Sel.ShapeRange.Count = 1 Then
With Sel.ShapeRange.Tags
For i = 1 To .Count
If (.Name(i) = "MYADDIN") Then
Load MyForm
MyForm.ButtonRun.Caption = "Work !!"
MyForm.Show
Cancel = True
Exit Sub
End If
Next
End With
End If
End If
End Sub








"Steve Rindsberg" wrote:

In order to debug the problem, I removed all the non-relevant code and
ended
up with a simple AddIns that open a form with two buttons
"OK","Cancel". Once
the user press "OK" it creates a rectangular shape on the current slide
and
close the form. As part of the code, this macro attaches a tag to the
rectangular so that when the user double-clicks on this shape it reopen
the
form, but this time the buttons are "Work","Cancel".

In both 2003, 2007 the first part works fine and the new rectangular is
added to the slide. However, in 2007 the second part does not work.
Double-clicking the rectangular brings the picture toolbar and does not
open
the form as expected. In 2003 it works find.

I can attach my .ppt file (and also the .ppa file) - but I don't see
how to
attach files to this question.

No need to attach the PPA, just copy and paste the relevant parts of the
code
here in the message box.

Particularly, mention how you're trapping the doubleclick on the
rectangle.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.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 03:41 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.