+ Reply to Thread
Results 1 to 10 of 10

Event when shape is moved

  1. #1
    Registered User
    Join Date
    02-24-2015
    Location
    Gent, Belgium
    MS-Off Ver
    2016
    Posts
    2

    Event when shape is moved

    Hi

    Is there anyone who knows a macro event that can be activated
    1. if a shape is selected (to show extra information about the meaning of that shape) BUT ALSO...
    2. if the user changes the sieze of that shape AND (to change the information based on it's new size)
    3. if the user moved that same shape (to change the information based on it's new position)

    I can not add the macro to the shape itself, because then you can not change the format of the shape or move the shape (without right clicking on it).

    Selectionchange or worksheetchange does not work for this.

    Thanks a lot!!!

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Event when shape is moved

    An active-x object can be used to trigger VBA (when object loses focus, mouse move etc) - what is the shape being used for?

    Why do you not want to use right-click to move and resize?

    What type of shape are you using?
    - attached workbook has a rectangle that can be moved and resized with right-click
    - when user clicks on shape latest information is presented in a message box
    - simple message box
    - T = TOP, = LEFT, W = WIDTH, H = HEIGHT


    .
    Pic1.jpg


    .

    Pic2.jpg

    .

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kev_; 03-17-2018 at 09:03 PM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Event when shape is moved

    Here the shape click event is used to move the shape (can also use to resize)
    - ie not using right-click

    The user is asked where to move the shape using an input box
    - the shape is then moved to selected cell
    - use a similar technique to ask user to resize the shape

    Please Login or Register  to view this content.
    Last edited by kev_; 03-17-2018 at 09:04 PM.

  4. #4
    Registered User
    Join Date
    02-24-2015
    Location
    Gent, Belgium
    MS-Off Ver
    2016
    Posts
    2

    Re: Event when shape is moved

    Hi kev_

    Thanks for your reply!! This kind of thing, I had already

    The question is if there is an event that I can write to do this without the right click (and so without the macro on the shape itself) to make it more user friendly.

    Thanks a lot!

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Event when shape is moved

    Is this what you want?
    Test in attached workbook

    MoveAndResizeShapeWithoutRightClick.jpg

    .

    Only click events apply to shapes.
    But here is a workaround using an active-x label:
    - label is placed directly above the shape
    - which allows label's MouseMove event to be used
    - could be adapted to deal with many shapes

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kev_; 03-18-2018 at 02:20 PM.

  6. #6
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Event when shape is moved

    1. if shape selected (to show extra information about the meaning of shape) - YES
    2. if the user changes the sieze of that shape AND (to change the information based on it's new size) - YES
    3. if the user moved that same shape (to change the information based on it's new position) - YES
    .

    Similar (and simpler!) without using the label
    - uses shape click event to achieve the same thing

    Test in attached workbook by clicking on the shape
    - after moving/resizing click on any cell

    In Standard module:
    Please Login or Register  to view this content.
    In Sheet module
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kev_; 03-19-2018 at 04:23 AM.

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Event when shape is moved

    Hi,

    There is an extremely complicated way to do this- https://www.mrexcel.com/forum/excel-...udo-event.html
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  8. #8
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Event when shape is moved

    @xlnitwit

  9. #9
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Event when shape is moved

    @kev_ Certainly not for the faint of heart.

  10. #10
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Event when shape is moved

    Quote Originally Posted by kev_ View Post
    @xlnitwit
    I liked your expression.


    Quote Originally Posted by xlnitwit View Post
    @kev_ Certainly not for the faint of heart.
    I liked your reply. Lol
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Form Click Event firing unexpectedly when a sheet is copied/moved into workbook
    By neilshaw3 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-26-2016, 08:03 AM
  2. [SOLVED] How to run macro everytime a shape is moved
    By Awni in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2016, 01:57 AM
  3. Trapping a Shape Change Event
    By yosemitejohn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2012, 04:45 AM
  4. [SOLVED] Event to trigger when a cell is moved
    By Marek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2006, 01:10 PM
  5. Trapping Add Shape Event
    By maso2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-15-2006, 10:11 AM
  6. Replies: 5
    Last Post: 06-23-2005, 06:05 PM
  7. Shape Selection Event !!
    By RAFAAJ2000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2005, 04:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1