RangeFromPoint(x,y) error...

E

Edi

Hi,
Im using word 2003 object model
but having a strange bug using the:

tmpRange = oWordApp.ActiveWindow.RangeFromPoint(x,y)
row = tmpRange.Cells[1].RowIndex;
column = tmpRange.Cells[1].ColumnIndex;

im trying to retrive a cell row and column from a table when ever
the mouse pointer is above it,
the problem appears when im tring to get cell that do not contain any data
(text)
in it and when table alignment is not left aligned

is there any solution to this issue?

Thanks
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?RWRp?=,

And what is the error, more specifically?
Im using word 2003 object model
but having a strange bug using the:

tmpRange = oWordApp.ActiveWindow.RangeFromPoint(x,y)
row = tmpRange.Cells[1].RowIndex;
column = tmpRange.Cells[1].ColumnIndex;

im trying to retrive a cell row and column from a table when ever
the mouse pointer is above it,
the problem appears when im tring to get cell that do not contain any data
(text)
in it and when table alignment is not left aligned

is there any solution to this issue?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
K

Klaus Linke

Edi said:
Hi,
Im using word 2003 object model
but having a strange bug using the:

tmpRange = oWordApp.ActiveWindow.RangeFromPoint(x,y)
row = tmpRange.Cells[1].RowIndex;
column = tmpRange.Cells[1].ColumnIndex;

im trying to retrive a cell row and column from a table when ever
the mouse pointer is above it,
the problem appears when im tring to get cell that do not contain
any data (text)
in it and when table alignment is not left aligned

is there any solution to this issue?

Thanks


Seems to work for me. How did you get the (x,y) coordinates?
Maybe select the cell, use
ActiveWindow.GetPoint pLeft, pTop, pWidth, pHeight, Selection.Range
to get the coordinates, and check if your x and y are in the rectange ((pLeft,pTop), (pLeft+pWidth,pTop+pHeight)).

One bug(?) I ran into last week is that .RangeFromPoint is off if your screen is set to 120 dpi instead of the default 96 dpi (as you sometimes have with large monitors: Desktop > Properties > Settings > Advanced) .

Regards,
Klaus
 
E

Edi

Hi again

There is no error its a bug i guess :)
The result of this is that in a non left aligned/Cell without text
im getting a wrong cell position e.g. (x,y)
if im over cell (1,1) im getting column index 2 which is wrong.

Thanks

Cindy M -WordMVP- said:
Hi =?Utf-8?B?RWRp?=,

And what is the error, more specifically?
Im using word 2003 object model
but having a strange bug using the:

tmpRange = oWordApp.ActiveWindow.RangeFromPoint(x,y)
row = tmpRange.Cells[1].RowIndex;
column = tmpRange.Cells[1].ColumnIndex;

im trying to retrive a cell row and column from a table when ever
the mouse pointer is above it,
the problem appears when im tring to get cell that do not contain any data
(text)
in it and when table alignment is not left aligned

is there any solution to this issue?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)


This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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