Hello,
I have the same problem. I'm developing in C#. The situation is that the user opens Word and then default a blank document is loaded. I added a new menu item so the user is able to open a form where he can select another Word document stored on a server.
He picks one document and presses a button 'Open file'.
Then I want to leave the default blank document open and create a new document where I load the selected document. The problem is that all the time when I run the code without debugging the default document is staying active instead of the new opened document.
After the document is opened, the popup form closes.
I use the DoEvent method, but that isn't working for me...
This is my code:
Code://Word.Document wdActive = wdApp.ActiveDocument; //wdActive.Application.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMinimize; //Application.DoEvents(); Word.Document wdDoc = wdApp.Documents.Open2000(ref fileName, ref missing, ref strfalse, ref strfalse, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref strtrue); //wdDoc.Application.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMaximize; //Application.DoEvents(); wdDoc.Activate(); Application.DoEvents(); frmWait.Hide(); frmWait.Close(); this.Hide(); this.Close(); Application.DoEvents();




Reply With Quote