![]() |
Plot where mouse clicks
I am trying to write some VBA code that will allow me to plot a
point/shape on a graph whereve I click my mouse. It must do this on the first click on the active chart. I have used a MouseDown event to get x nad y coordinates but when I place a shape at this (x,y) coordinate it does not appear at the point where i clicked my mouse. The offset does not seem to be a constant value. Can somebody please help me with this or advise me on another aproach to reach my objective? Thanks |
Plot where mouse clicks
I think it is the old story where you have got so far and need mor information for the next step. I have done some work with this - mainly getting data from extrna applictions. I think that, where you are at the moment, you have d recognise that mouse co-ordinates can relate to the full monitor scree or the active window, and Excel VBA co-ordinates probably relate t neither. I remember somewhere seeing some calculations to convert mous pixel co-ordinates to "mickeys". I remember getting problems if th user did not have the application window maximised - when it could b any size. Here isa bit of Excel code, which I see relates screen co-ordinates 0, to the top left of cell A1. The Height is the same as Row Height bu Width is NOT the same as Cell Width. '--------------------------------------------------------------------------- Sub GET_CELL_POSITION() ActiveCell.Offset(0, 1).Value = ActiveCell.Address & " Top : " ActiveCell.Top & " Points." ActiveCell.Offset(1, 1).Value = ActiveCell.Address & " Left : " ActiveCell.Left & " Points." ActiveCell.Offset(2, 1).Value = ActiveCell.Address & " Height : " ActiveCell.Height & " Points." ActiveCell.Offset(3, 1).Value = ActiveCell.Address & " Width : " ActiveCell.Width & " Points." End Sub '------------------------------------------------------------------------- ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
All times are GMT +1. The time now is 12:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com