Quantcast
Channel: General Office Development forum
Viewing all articles
Browse latest Browse all 2257

PowerPoint VBA: Event trigger after Drag and Drop

$
0
0

Hi,

I am working on a PowerPoint 2013 project and I want to implement an event associated to Drag and Drop of pictures into a slide, but I am not capable of triggering the event Application.AfterDragDropOnSlide. Could one of you guys help me? I think I wrote the code correctly, so my guess is either drop of pictures are not meant to trigger the event or the event itself is malfunctioning. I posted my code under so you could verify it.

This is my Class Module, named cEventHandler

Option Explicit

Public WithEvents PPTEvent As Application

Private Sub Class_Initialize()
MsgBox ("Initiated")
End Sub

Private Sub Class_Terminate()
MsgBox ("Terminated")
End Sub

Private Sub PPTEvent_AfterDragDropOnSlide(ByVal Sld As Slide, ByVal X As Single, ByVal Y As Single)
MsgBox ("Triggered DragDrop")
End Sub

Private Sub PPTEvent_AfterShapeSizeChange(ByVal shp As Shape)
MsgBox ("Triggered ShapeChange")
End Sub

And this is my Module1

Dim cPPTObject As New cEventHandler
Dim TrapFlag As Boolean

Sub TrapEvents()
If TrapFlag = True Then
   Exit Sub
End If
   Set cPPTObject.PPTEvent = Application
   TrapFlag = True
End Sub

Sub ReleaseTrap()
If TrapFlag = True Then
   Set cPPTObject.PPTEvent = Nothing
   Set cPPTObject = Nothing
   TrapFlag = False
End If
End Sub
The other event I am testing, Application.AfterShapeSizeChange, is working correctly.


Viewing all articles
Browse latest Browse all 2257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>