View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Mouse position within worksheet

Ah, the brackets, how observant. Aircode I'm afraid but they were there by
intention!

Trust the demo worked, but please advise if anything not quite right.

Regards,
Peter T


"Andrew" wrote in message
...
Embarrassingly I failed to compute that top of A1 is just 0!! Too
busy thinking about everything else.

BTW, there's a bracket missing in your expression below though.
Should be:
(CursorPixelsX - PointsToScreenPixelsX(0)) * ppp * zoom%
since it's the distance from top left of A1 to the cursor which
changes with zoom etc. (I know you know this since it is what you
have in your code that you posted later).

Thanks!

On 10 Feb, 13:28, "Peter T" <peter_t@discussions wrote:
I think you may be missing one or two things (not sure), in essence the
position of the mouse pointer in points from the top-left corner of the
sheet is

CursorPixelsX - PointsToScreenPixelsX(0) * ppp * zoom%

where CursorPixelsX is returned from 'GetCursorPos' and ppp refers to
'Points-per-Pixel' typically 0.75 but confirmed with a few API calls.

There are one or two other things that might also need to be taken into
account. Having had another look at some old stuff I should be able to
post
a simple demo here later today, rather than something needing to be
wrapped
in a workbook.

Regards,
Peter T


<snip