JRQ

Is there a way to tell Word automation object not to save the current window position when Quit() is called

Basically, I'm trying to reuse Word Spellchecker in my project. So I assign the Top property of the automation object to -3000 to move it off the screen. Then set the Visible to False so it won't show up on the taskbar.

However, when the automation object if finally closed and released. The last location is saved as the default starting position for standalone Word application which happens to be off the screen.



Re: Visual Studio Tools for Office Word Automation and Default Window Position

Douglas H. Troy

So why not just reposition the Spell Checker in screen center before you close out





Re: Visual Studio Tools for Office Word Automation and Default Window Position

JRQ

You mean the Word window.

Yeah, I ended up doing that now. I'm saving the current value of the Top property then re-assign it back before closing. However, you will actually see the Word Application window flashes when the Top property is re-assigned before closing out.

That's the problem I was trying to solve, that's why I'm moving the Word Application off-screen.





Re: Visual Studio Tools for Office Word Automation and Default Window Position

John R. Durant - MSFT

Why are not use the Application.Visible property

John






Re: Visual Studio Tools for Office Word Automation and Default Window Position

Douglas H. Troy

Misunderstood; thought you were moving the Spell Check dialog, not the application window.

Looks like someone else has answered your question.





Re: Visual Studio Tools for Office Word Automation and Default Window Position

JRQ

Application.Visible works fine on initial display. I'm actually using that property.

Unfortunately, the Word Application window still shows up even if the Visible is set to FALSE when Documents:CLOSE(FALSE) is called. This is needed to avoid the save document question dialog-box from displaying. Then I follow it with Application.Quit() which closes the Word Application window. So to prevent the user from seeing the flashing of Word, I programmatically moved it off-screen.

Which brings me to my original problem.





Re: Visual Studio Tools for Office Word Automation and Default Window Position

JRQ

Yes, I'm moving the application window off-screen.

For some reason when I call Application.CheckSpelling(), spell checker doesn't follow the application window. So no additional manipulation of the spelll checker dialog-box is needed.





Re: Visual Studio Tools for Office Word Automation and Default Window Position

JRQ

Found the solution;

To Load Word on the background;

Set it to minimized state
Set the visibility to false

To Unload

Set the Document.Saved to true instead of using Word.Documents.Close(0) - this stops the app from asking the user to save and it doesn't changes the visibity of Word.
Then Quit Word