ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving shapes with the mouse (https://www.excelbanter.com/excel-programming/370272-re-moving-shapes-mouse.html)

NickHK

Moving shapes with the mouse
 
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

"pan65" wrote in message
...
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?




pjakop1

Moving shapes with the mouse
 

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...

--
pjakop
-----------------------------------------------------------------------
pjakop1's Profile: http://www.excelforum.com/member.php...fo&userid=3747
View this thread: http://www.excelforum.com/showthread.php?threadid=57121



All times are GMT +1. The time now is 07:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com