none
Application.Documents.Open closing the un saved word documents

    Question

  • I am opening an existing word document using below code.

     m_WordAppln.Documents.Open(ref varFileName, ref m_Missing, ref m_Missing, ref m_FalseValue,
                                ref m_Missing, ref m_Missing, ref m_FalseValue, ref m_Missing, ref        m_Missing, ref m_Missing, ref m_Missing, ref m_Missing, ref m_Missing,
          ref m_Missing, ref m_Missing, ref m_Missing);

    Above above API is closing other un saved open word documents. (just open a new document using winword.exe from start menu)

    How to fix this problem?


    jeudi 3 mai 2012 23:22

Réponses

  • Hi Akella

    The behavior you described is by design. This is what happens when the user starts Word (a blank document is generated automatically), then opens a document (the blank document is closed). The assumption is that the user doesn't want to work with this new document when the first action is to open an existing one. So to save the user effort, the blank document is closed.

    If you need the blank document, you either need to make some changes in it (make it "dirty"), save it, or simply create another new one (m_WordAppIn.Documents.Add(//params here);


    Cindy Meister, VSTO/Word MVP

    vendredi 4 mai 2012 06:11
    Modérateur