Anand Navale

Anand Navale

  • NA
  • 149
  • 6.8k

Problem on word document open in maximize screen in word 365

Aug 30 2019 12:39 AM
I have word document, open that word document in maximize screen directly when i using word 13/16 but problem on word 10/365 it has open but goes to task bar using VB.Net,
 
Please provide me solution....
 
What I have tried:
  1. Dim WordApp As New Microsoft.Office.Interop.Word.Application  
  2. Dim DocToOpen As Microsoft.Office.Interop.Word.Document  
  3. DocToOpen = WordApp.Documents.Open(CStr(szDisplayFile))  
  4. WordApp.WindowState = Word.WdWindowState.wdWindowStateMaximize  
  5. WordApp.ActiveWindow.ActivePane.View.Zoom.Percentage = 100  
  6. WordApp.Visible = True  
  7. ActivateDocumentWindow(szDisplayFile)  
  8. WordApp.Activate()  
  9. Application.DoEvents()  
  10.   
  11. Public Sub ActivateDocumentWindow(ByVal a_strDocName As String)  
  12. Dim Alllocal As Process() = Process.GetProcesses()  
  13. Dim Item As Process  
  14. 'Loop through all processes to locate and activate our document  
  15. For Each Item In Alllocal  
  16. 'if the main title is not blank  
  17. If Item.MainWindowTitle.ToString <> "" Then  
  18. If InStr(Item.MainWindowTitle.ToString, a_strDocName) > 0 Then  
  19. Dim intOurDoc As Integer = Item.Id  
  20. AppActivate(intOurDoc)  
  21. Exit For  
  22. End If  
  23. End If  
  24. Next  
  25. End Sub  

Answers (1)