Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2007

Tip: Looking for answers? Try searching our database.

Get Word's cursor coordinates on the screen

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Guillermo López-Anglada - 20 Jun 2007 22:26 GMT
Hi,

I have a form that opens on top of a doc so the user can perform a search. The form is rather minimal, but
it still gets in the way sometimes and covers the search hit (selected text in the doc).

I want the form to move out of the user's view. Since the search hit is selected, I could use the
insertion point's position on the screen as reference, but I don't know how to do that in VBA or using an
API call.

Any help would be highly appreciated.

Regards,

Guillermo
Jonathan West - 20 Jun 2007 22:45 GMT
> Hi,
>
[quoted text clipped - 7 lines]
>
> Any help would be highly appreciated.

There is nothing in the Word object model that will tell you the location of
the cursor on screen. It might be possible to do using the Windows API, but
I don't know how. You might get some help from the group
microsoft.public.vb.winapi. Make sure you clearly state you are using VBA in
Word - that group deals with VB6, but it is sufficiently similar to VBA that
they may be able to help, but it will assist them if they know what they are
dealing with.

However, it might prove not to be possible at all - Word's windows are
pretty weird and non-standard beasts, and trying to hook them by normal
Windows techniques often has undesirable side effects.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

Tony Jollans - 24 Jun 2007 22:55 GMT
(Window_Ref).GetPoint will return the position in the window of the
Selection - in pixels. Form co-ordinates are measured in points so you will
need to convert using PixelsToPoints. These numbers can be awkward to work
with and may be unreliable but it is certainly better than nothing.

Signature

Enjoy,
Tony

> Hi,
>
[quoted text clipped - 11 lines]
>
> Guillermo
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.