Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bring Word Application to Front

I programmatically create a Word document and ask the user if he want's to display the document right now.

In order to bring the document to front I minimize and maximize the document. The document comes to front of screen but in an 'impolite' way: you can see it gets minimized and maximized.

Any idea how to 'educate' it?

wordApp.Visible = true;//objApp is the word application defined in my application
//minimizing and maximizing bring the Word application to front
wordApp.WindowState=WdWindowState.wdWindowStateMinimize;
wordApp.WindowState=WdWindowState.wdWindowStateMaximize;
wordApp.Activate();
like image 865
user3041065 Avatar asked Dec 05 '13 18:12

user3041065


People also ask

How do I get my Word document to start at the top?

If your document is in Print Layout view and the top and bottom margins appear to be cut off, the option for hiding margins has been switched on. Here's how to switch it off: Point to the top or bottom of a page until the pointer becomes a double-pointed arrow, and then double-click.


2 Answers

I found that activating both the Doc and the App brought word to the front, at least it did for me.

oDoc.Activate();
oWordApp.Activate();
like image 162
oldCOBOLdude Avatar answered Sep 22 '22 12:09

oldCOBOLdude


If you remove the Minimize and Maximize and use wordApp.Show() does that help resolve your issue? Every time I display a new application I use .Show not .Activate. Hope that helps.

like image 34
KSdev Avatar answered Sep 19 '22 12:09

KSdev