How can I change the ActiveDocument property in Office.Interop.Wor

M

Mario Montes

Hi,
I have a C# Windows Forms app that uses separate instances of the WebBrowser
control to host Word documents. Assume I have 2 open. The last one opened
becomes the _application.ActiveDocument. This does not change even when I
bring the first opened document to the foreground. I can edit that one but
right
clicking on a misspelled word does not invoke the spelling menu as it does on
the last document opened. I wish I could do something like
_application.ActiveDocument = _document so that I could set the
_application.ActiveDocument property at will. Unfortunately, that property is
ReadOnly. Is there another way I can reset the ActiveDocumet property?
Thanks for your help!
 
M

Mario Montes

I found the answer to my question: _document.SetFocus() will update the
applications ActiveDocument. Unfortunately this did not solve my problem as
I had hoped. The Word context menu (not just the spelling menu as mentioned
in the original post) is no longer available for the first document. If I
close and reopen first, the context menu is back for this document, but is
no longer available if I swicth to the other.

Any ideas?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top