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 / October 2006

Tip: Looking for answers? Try searching our database.

How to set focus to Word using automation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PromisedOyster - 19 Oct 2006 08:26 GMT
Our application integrates tightly with Word using automation.

In certain instances we are finding that Word has a dialog open but the
user is not aware of this because Word does not have focus.

How can we force Word to get focus.

I have tried the following but to no avail:

_wordApp.ShowMe();
_wordDoc.ActiveWindow.SetFocus();

(If we control the opening of Word then this works OK. However, if
attach to an existing instance of Word AND it was already maximised
then this is where we have the issue).
Jezebel - 19 Oct 2006 10:27 GMT
The better (and easier) solution is to make sure that Word doesn't display
any dialogs. If your application is (as you claim) tightly integrated, this
is not difficult.

> Our application integrates tightly with Word using automation.
>
[quoted text clipped - 11 lines]
> attach to an existing instance of Word AND it was already maximised
> then this is where we have the issue).
PromisedOyster - 19 Oct 2006 12:35 GMT
There are a couple of instances where we do want to activate Word, ie
to show the results of a spellcheck and to show the document that has
been automatically produced (to give the user the option to change).

I neglected to say in the original post that we are also calling the
Activate() method.

> The better (and easier) solution is to make sure that Word doesn't display
> any dialogs. If your application is (as you claim) tightly integrated, this
[quoted text clipped - 15 lines]
> > attach to an existing instance of Word AND it was already maximised
> > then this is where we have the issue).
Jezebel - 19 Oct 2006 13:18 GMT
If Word is activated, then dealing with the dialogs is the user's
responsibility. You really can't have it both ways: either Word is under
your app's control, or it's under your user's control.

> There are a couple of instances where we do want to activate Word, ie
> to show the results of a spellcheck and to show the document that has
[quoted text clipped - 24 lines]
>> > attach to an existing instance of Word AND it was already maximised
>> > then this is where we have the issue).
PromisedOyster - 20 Oct 2006 12:41 GMT
Yes I understand this. All I am asking for is for is the Word
Automation commands to ensure that Word gets focus as the Activate()
nor the SetFocus() command does not always seem to work.

> If Word is activated, then dealing with the dialogs is the user's
> responsibility. You really can't have it both ways: either Word is under
[quoted text clipped - 28 lines]
> >> > attach to an existing instance of Word AND it was already maximised
> >> > then this is where we have the issue).
Art H - 22 Oct 2006 01:44 GMT
See if this thread helps

http://groups.google.com/group/microsoft.public.excel.programming/browse_frm/thr
ead/605cf5361d1efccc/cf2dd38d38d7e3fd?lnk=gst&q=application.caption&rnum=1#cf2dd
38d38d7e3fd


Art

> Our application integrates tightly with Word using automation.
>
[quoted text clipped - 11 lines]
> attach to an existing instance of Word AND it was already maximised
> then this is where we have the issue).
PromisedOyster - 22 Oct 2006 09:20 GMT
It looks like others are also having the same issue. I saw the
following post, however, it does seem a bit messy:

http://groups.google.com/group/microsoft.public.office.developer.automation/brow
se_thread/thread/2a56313a44625314/0da5fb2afb9bcde4?lnk=st&q=Activate+Word+focus+
.net&rnum=2#0da5fb2afb9bcde4


> See if this thread helps
>
[quoted text clipped - 17 lines]
> > attach to an existing instance of Word AND it was already maximised
> > then this is where we have the issue).
 
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.