Word Doc opened from Excel code has limited status bar RRS feed

  • Question

  • Using MS Office 2007 and Windows Vista.

    When I use the code below in an Excel procedure to open a MS Word document, parts of the status bar at the bottom of the Word document are missing.  Specifically, at the bottom left the page number, Line Number, Column Number and Word Count are missing, though the text "Words; 0" is shown greyed out.  At the bottom right the slider to change size is shown but is inoperative and no percentage size is shown.  The only usable items on the status bar are therefore the macro recorder button at bottom left and the layout selectors at bottom right.  The code shown is cut down from a procedure that I use, but demonstrates the problem.  When I open the document manually by double clicking on the file name all status bar functions and data are present.  Am I missing a command somewhere?

    Sub GetDocument()

    Const strPath = "C:\Users\Andy Collins\Documents\TestDoc1.doc"
    Dim TestDoc As Object
        Set TestDoc = GetObject(strPath)
            With TestDoc.Parent
                .Visible = True
            End With
        Set TestDoc = Nothing
    End Sub

    With thanks for any advice

    Andy C

    Saturday, May 9, 2015 11:39 AM


All replies

  • Having shut down my PC overnight and restarted the next day I find that the problem has gone away!  I had spent much of the day doing various bits of coding (some of which locked up the MS Office programs) so clearly something I did caused this problem.  I shall investigate further and try to reproduce it, but the problem is clearly not one that always occurs.
    Sunday, May 10, 2015 5:01 PM
  • Hi AndyColRomsey,

    I suggest that you could open the document by using Documents.Open method.

    There is a thread that can help you:

    # Opening a Word Document from an Excel VBA Module




    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by AndyColRomsey Monday, May 11, 2015 10:03 AM
    Monday, May 11, 2015 8:52 AM
  • Hi Starain

       Thanks for looking at this.  Something very odd is going on!  Having returned to my computer after a couple of hours the problem is there again after having disappeared earlier.  Nonetheless, I have now returned to the Documents.Open method, which works OK.  I had gone for the GetObject method as it was commendably simple.

       For anyone else who wishes to delve further, I have now found that if a Word document is already open with the status bar working normally, running the code in my first question opens the test document normally with a fully functioning status bar.  If no instance of word is running, then the problem remains.

    With thanks

    Andy C

    Monday, May 11, 2015 10:03 AM