Problem with Excel macro to open Word files


  1. Posts : 4
    Windows 10
       #1

    Problem with Excel macro to open Word files


    I am having a problem with an Excel macro which opens Word files. The macro opens the files OK but sometimes the file is not visible; instead, it is hidden in the window behind the Excel Workbook and the Word icon on the taskbar flashes to show that the file is open. I want the Word file to appear visible on-screen automatically without my having to click on the taskbar.

    The relevant part of the macro is:

    Set objWord = CreateObject("Word.Application")
    With objWord
    .Documents.Open DocsFullPath(i)
    .Visible = True
    .Activate
    .Application.WindowState = 1
    .ActiveWindow.ActivePane.View.Zoom.Percentage = 100
    End With
    GoTo Finish

    Can anyone help me resolve this? It's been driving me mad!
      My Computer


  2. Posts : 194
    Windows 10 Pro
       #2

    Have you tried adding the following
    Code:
    Sub WordtoFront()
        Set wordapp = CreateObject("word.Application")
        wordapp.documents.Open "C:\Users\User\Desktop\TestWord.docx"
        wordapp.Visible = True
        Application.ActivateMicrosoftApp xlMicrosoftWord
    End Sub
      My Computer


  3. Posts : 4
    Windows 10
    Thread Starter
       #3

    Thanks for your help - everything seems now to be working as I wanted. I really appreciate your help!
      My Computer


  4. Posts : 194
    Windows 10 Pro
       #4

    No problem, happy to help
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 19:59.
Find Us




Windows 10 Forums