RangeFromPoints

P

pmt32577

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
 
D

David Welch

pmt32577 said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top