+ Reply to Thread
Results 1 to 5 of 5

find coordinates of point clicked, relative to picture edges

  1. #1
    Registered User
    Join Date
    03-30-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    3

    find coordinates of point clicked, relative to picture edges

    Hi forum members:

    It's my first post here, and yeah I need help with something.. really hope one of ya will be willing to demonstrate great geek generosity to moi.

    I'm trying to create a macro that will return the coordinates of the point clicked on the picture relative to the extents of the picture edges. In other words, when i click on the picture it will compare the current cursor position (not cell position) with the position of the edges of the picture and give me back a consistent relative position to the picture.

    I need this as for work purposes I need to figure out how to click on a map of something and have it give me the coordinates of the point on the map that was clicked on.

    I've seen some code that can use the edges of charts as position data, but not for picture edges. Is there such a thing available?

    Anyone able to help me out?

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: find coordinates of point clicked, relative to picture edges

    Load your picture into an image control. You can then use the mouse events of the image control to capture the xy position
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    03-30-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: find coordinates of point clicked, relative to picture edges

    Oh okay.. Uh. Can I have some clues or some sample code to show which mouse events to use? Browsing the help files are confusing me quite a lot. Unfortunately I don't have much background in Visual Basic...

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: find coordinates of point clicked, relative to picture edges

    Add an image from the Control Toolbox toolbar
    In design mode right click image and pick View Code.

    paste this code in to the editor
    Please Login or Register  to view this content.
    Turn off design mode and click the image.

  5. #5
    Registered User
    Join Date
    03-30-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: find coordinates of point clicked, relative to picture edges

    Hooray! It's exactly what I needed.

    Greatly appreciated Andy!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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