Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > PowerPoint

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-24-2008, 03:27 AM
=?Utf-8?B?TG9zdE15QnJhaW4=?=
 
Posts: n/a
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.
Reply With Quote
  #2 (permalink)  
Old 07-24-2008, 02:45 PM
Steve Rindsberg
 
Posts: n/a
Re: 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

Reply With Quote
  #3 (permalink)  
Old 07-24-2008, 04:01 PM
=?Utf-8?B?TG9zdE15QnJhaW4=?=
 
Posts: n/a
Re: 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, _
before:=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
>
>

Reply With Quote
  #4 (permalink)  
Old 07-25-2008, 03:19 PM
Shyam Pillai
 
Posts: n/a
Re: 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" <LostMyBrain@discussions.microsoft.com> wrote in message
news:241458C3-1FFD-4196-937E-2A27CE1D9E02@microsoft.com...
> 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, _
> before:=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
>>
>>


Reply With Quote
  #5 (permalink)  
Old 07-25-2008, 03:32 PM
=?Utf-8?B?TG9zdE15QnJhaW4=?=
 
Posts: n/a
Re: 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" <LostMyBrain@discussions.microsoft.com> wrote in message
> news:241458C3-1FFD-4196-937E-2A27CE1D9E02@microsoft.com...
> > 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, _
> > before:=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
> >>
> >>

>
>

Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > PowerPoint


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:04 AM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
MPAA | Mortgages | Personal Loans | Loans | Mortgage Calculator



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109