Thread: RangeFromPoints
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
pmt32577 pmt32577 is offline
external usenet poster
 
Posts: 2
Default RangeFromPoints

Of course! well using ClientToScreen instead anyway.

Many thanks!


"David Welch" wrote:

pmt32577 wrote:
I am trying to discover which cell is under the mouse using automation calls
from C++. I take the mouse co-ordinates, which are relative to my Excel
window, add in the windows screen co-ordinates to get a screen position and
call RangeFromPoints. However, the range returned is 'out' by a bit. On my
1600*1200 screen it is out by 32X and 42Y. This is constant regardless of my
window positions, both the main window and the workbook window and is also
constant across the workbook so doesn't seem to be a scaling issue or an
offset issue. This difference is independant of screen resolution but does
change (not linearly) with the zoom. On a second computer running 1280*960
running Office XP rather than Office 2003 the difference was 32X,49Y????

Has anybody any idea what I could be missing.

Thanks


You could try using the ScreenToClient API function, passing in the
handle of the excel workbook.