Dear Developers, A Noob Question...

K

Kafka

Dear guys and girls,
I've been trying to do this task for a while now, I can't seem to find any
meaningful information about it so I really hope someone here could help.
I've started writing an add in for MSWord, I'm trying to locate a word
within a document and by the selection (cursor) position in the document I
would like to add some of my own graphics (for UI). The problem I have is
getting the information off the Word API. How Do I by character position get
the Absolute Screen position and the reverse, how do I from the Screen X-Y
get the Character position.
Hope the my question phrasing is ok, It's abit too early in the morning for
pretty theoretics.
Many thanks and a Great day to us all.
 
H

Helmut Weber

Hi Kafka,

are you sure you want the absolute "screen" position?

Or isn't it rather about the position of a word in a document
relative to page or text borders?
Like: first occurance of "graphics" is located 5 cm
from page top and 8 cm from page left?

I don't think you want your graphis appear at a certain position
on the screen but at a certain position on a page.

In Points:
MsgBox Selection.Information(wdHorizontalPositionRelativeToPage)
MsgBox Selection.Information(wdVerticalPositionRelativeToPage)
how do I from the Screen X-Y get the Character position.

Don't think this is feasable, at least not with justifiable effort.
What good would it be for to know,
what character is at position(300,400) on the screen?
Quite some times there might not be a character at all.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
K

Kafka

Many thanks!

Helmut Weber said:
Hi Kafka,

are you sure you want the absolute "screen" position?

Or isn't it rather about the position of a word in a document
relative to page or text borders?
Like: first occurance of "graphics" is located 5 cm
from page top and 8 cm from page left?

I don't think you want your graphis appear at a certain position
on the screen but at a certain position on a page.

In Points:
MsgBox Selection.Information(wdHorizontalPositionRelativeToPage)
MsgBox Selection.Information(wdVerticalPositionRelativeToPage)


Don't think this is feasable, at least not with justifiable effort.
What good would it be for to know,
what character is at position(300,400) on the screen?
Quite some times there might not be a character at all.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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