Moving shapes with the mouse

G

Guest

I have placed shapes on a spread sheet. I would like to write some code so
that when one or more shapes are selected and moved with the mouse, the
direction that the shape(s) can be moved is controled. For instance, the
shape(s) can only moved up and down but never left or right. Can some one
help me?
 
N

NickHK

As Excel exposes neither the mouse movement on the worksheet nor a
Shape_Activate/Click or any other events, it's not straightforward.
You could certainly use the API to hook the mouse and move the shape(s), but
it would be much easier to give the user a modeless userform with button to
click up/down and left/right which you can disable/enable depending on what
you permit.
Then you have your event to react to in moving the shapes, ensuring that
Selection is what you expect.

NickHK
 
P

pjakop1

If you work with shapes on a chart, you can use chart events an
procedures OnMouseMove, OnMouseUp, OnMouseDown...

Read this page, it helped me:

http://www.computorcompanion.com/LPMArticle.asp?ID=221


I have also anoter question related to this:

How to make excel NOT to change mouse cursor when placing on shape an
how to make him IGNORE clicks on shape (not selecting it). I made som
cross cursors which follow the mouse in chart, but I cant selec
serries data by click now, because always when I click somewhere, thi
moving cursors are selected... (created with shapes.addline...
 

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