View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Andrew[_16_] Andrew[_16_] is offline
external usenet poster
 
Posts: 66
Default Mouse position within worksheet

Hi Peter,

Thanks for for the reply.

I have a series of buttons displayed on the Ribbon which should insert
a picture at a location selected by the user (by clicking on the
worksheet). I need to be able to translate the mouse location to the
appropriate sheet coordinates in order to insert the picture at the
right spot.

Thanks again,
Andrew





On 8 Feb, 15:21, "Peter T" <peter_t@discussions wrote:
That approach doesn't work in 2007+ as embedded charts are not windows in
they way they were in previous versions.

There are other ways of relating mouse coordinates to a cell address, or a
cell position to screen coordinates depending on the overall objective.

Regards,
Peter T

"Andrew" wrote in message

...



Some years ago I remember reading an approach for determining the
mouse position within a sheet. *I believe this used the GetCursorPos
API to find the "absolute" mouse position relative to the window, then
inserted a dummy chart object in cell A1, set a handle to this and
then compared the coordinates of the chart to the mouse position to
determine its relative position on the sheet. *I've spent about an
hour now searching for this code without success - does anyone have a
copy they could re-post?


Thanks a lot,
Andrew- Hide quoted text -


- Show quoted text -