Discussion:
How to programmatically bring a Word window to front?
(too old to reply)
Andrew
2008-03-28 14:39:01 UTC
Permalink
Raw Message
Hello, friends,

In c#.net 2005, we have the following source, hoping to bring a Word window
to front. However, it does not work.

Any ideas? How to bring a Word window to front?

Thanks a lot.

------------------- source code

foreach (Microsoft.Office.Interop.Word.Document doc in this.wordApp.Documents)
{
if (String.Compare(doc.Path + "\\" + doc.Name, fullPathFileName, true)
== 0)
{
doc.Activate();
return;
}
}
Roßert G. Schaffrath
2008-03-29 15:02:13 UTC
Permalink
Raw Message
I don't believe you can bring the document to the foreground with
doc.Activate() call, only make it the active document. You should call
this.wordApp.Activate() after doc.Activate() to bring the Word window to
the foreground.

Robert
Post by Andrew
Hello, friends,
In c#.net 2005, we have the following source, hoping to bring a Word window
to front. However, it does not work.
Any ideas? How to bring a Word window to front?
Thanks a lot.
------------------- source code
foreach (Microsoft.Office.Interop.Word.Document doc in this.wordApp.Documents)
{
if (String.Compare(doc.Path + "\\" + doc.Name, fullPathFileName, true)
== 0)
{
doc.Activate();
return;
}
}
Rahul Nandani
2010-10-12 18:14:44 UTC
Permalink
Raw Message
String.Compare method which u described is not working correctly plz suggest me some alternative to activate already open word document
Post by Andrew
Hello, friends,
In c#.net 2005, we have the following source, hoping to bring a Word window
to front. However, it does not work.
Any ideas? How to bring a Word window to front?
Thanks a lot.
------------------- source code
foreach (Microsoft.Office.Interop.Word.Document doc in this.wordApp.Documents)
{
if (String.Compare(doc.Path + "\\" + doc.Name, fullPathFileName, true)
== 0)
{
doc.Activate();
return;
}
}
Post by Roßert G. Schaffrath
I don't believe you can bring the document to the foreground with
doc.Activate() call, only make it the active document. You should call
this.wordApp.Activate() after doc.Activate() to bring the Word window to
the foreground.
Robert
Submitted via EggHeadCafe - Software Developer Portal of Choice
Lucene.Net Indexing Searching Entry Level Tutorial
http://www.eggheadcafe.com/tutorials/aspnet/c69ef65f-e3c6-409e-ab97-168897c74f83/lucenenet-indexing-searching-entry-level-tutorial.aspx
Loading...