drag and drop

M

Marge S

I would like to be able to have people use pieces I have placed on a PPT
slide and in slideshow view, be able to drag them to a specific place. Is
that possible with VBA to :
1. allow them to drag and drop shapes
2 for VBA to recognize that they were dropped at a specific coordinate set??
Thanks,
Marge from Tampa
 
B

Bill Dilworth

No, PowerPoint doesn't have this ability natively, but you can move stuff
around on the slide by using a little VBA and action settings.

First, Copy the Code into the VBE (Visual Basic Editor) Window. You can
open this window (if VBA is enabled from your Office Installation) by typing
Alt and F11 keys.

Second, create four arrows that point left, right, up and down. These can
be make using Autoshapes. I also recommend placing a larger circle behind
the group of four arrows (just in case you miss with the mouse click). Then
assign an Action Setting to each of the arrows, MoveUp for up, MoveRight for
right, and so on. Assign the action setting - on mouse click 'Nada' for the
circle behind the arrows. Lastly, on any object you would like to be able
to move, assign 'MoveObj' macro, to the mouse over Action setting (or mouse
click, your call).

Now, here's what it does. When the mouse passes over an object that you
have 'activated' with the 'MoveObj', it becomes the thing that will be
moved. When the arrows are clicked, that item moves a little in the
direction the arrow points.

Please note a couple of things:
1) Objects do not have to be showing to be moved, so unrevealed objects and
objects from the most recent activation will move even if you can not see
them moving.
2) If VBA support has not been installed with Office, this will not work.
3) If Macro security is set to High, this will be deactivated. Determine
the correct Macro security level for your use.
4) The amount of distance that an objects moves can be changed in the code
5) Any object can be assigned to move others, not just arrows.
6) Objects that go up, do not have to come down. The changed location of
the objects will register as a presentation update and you will be prompted
to Save when the presentation is closed.

So here is the simple VBA code,

======Begin Code==========
Public LastObj As Shape

Sub MoveObj(oShp As Shape)
Set LastObj = oShp
End Sub

Sub MoveLeft(oShp As Shape)
LastObj.Left = LastObj.Left - 5
DoEvents
End Sub

Sub MoveRight(oShp As Shape)
LastObj.Left = LastObj.Left + 5
DoEvents
End Sub

Sub MoveUp(oShp As Shape)
LastObj.Top = LastObj.Top - 5
DoEvents
End Sub

Sub MoveDown(oShp As Shape)
LastObj.Top = LastObj.Top + 5
DoEvents
End Sub

Sub Nada()
DoEvents
End Sub
======End Code==========

Play safe, have fun,

--
Bill Dilworth, Microsoft PPT MVP
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of our questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..
 
J

Jeff Bennett

Marge S said:
I would like to be able to have people use pieces
I have placed on a PPT slide and in slideshow view,
be able to drag them to a specific place.
Is that possible with VBA to :
1. allow them to drag and drop shapes
2 for VBA to recognize that they were dropped at a specific coordinate set??
Thanks,
Marge from Tampa

Would you be willing to use an ActiveX component within PowerPoint?
If yes, then this is easy.

Our Metadraw control allows you to create multiple shapes ( by code or
by end-user drawing ) within a single scrollable, zoomable frame, and
to drag these around with the mouse within that window. You'll have
full control through VBA and will be able to tell exactly where each
shape is located.
Check it out at www.Bennet-Tec.Com


=> Drop me a note if this is of interest to you.
I'd be happy to answer questions on MetaDraw
and to get you started with evaluation.
( please include a copy of this note with your reply )


-----

Jeff Bennett
(e-mail address removed)

* Bennet-Tec Information Systems, Inc
* 50 Jericho Tpk, Jericho, NY 11753
* Phone 516 997 5596, Fax - 5597
* RELIABLE Components Make You Look Sharp!
* TList/Pro * ALLText HT/Pro * MetaDraw *
* Custom Software Development Services Too.
* WWW.Bennet-Tec.Com

=================== ===================
 

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