Attempted to read or write protected memory while open a WordDocument

Discussion in 'Word Programming' started by AJ, Dec 9, 2009.

  1. AJ

    AJ Guest

    Hi ..I have a WinXP SP2 machine on which Office 2007 SP2 is
    installed.Things worked fine when office SP1 was installed.Since the
    time SP2 has been insatlled,I get the Below Exceptions when trying to
    open a WordDocument(.docx)
    Below are my lines of code
    Word.Document doc;
    object wordTrue = (object)true;
    object wordFalse = (object)false;
    object missing = System.Reflection.Missing.Value;
    object fileToOpen = targetDocxDoc;

    doc = Globals.ThisAddIn.Application.Documents.Open(
    ref fileToOpen,
    ref missing, ref wordFalse, ref wordFalse, ref
    missing,
    ref missing, ref missing, ref missing, ref missing,
    ref missing, ref missing, ref missing, ref missing,
    ref missing, ref missing, ref missing);

    The line Documents.Open gives teh following Exception Deatls ---

    System.AccessViolationException occurred
    Message="Attempted to read or write protected memory. This is often
    an indication that other memory is corrupt."
    Source="Microsoft.Office.Interop.Word"
    StackTrace:
    at Microsoft.Office.Interop.Word.Documents.Open(Object&
    FileName, Object& ConfirmConversions, Object& ReadOnly, Object&
    AddToRecentFiles, Object& PasswordDocument, Object& PasswordTemplate,
    Object& Revert, Object& WritePasswordDocument, Object&
    WritePasswordTemplate, Object& Format, Object& Encoding, Object&
    Visible, Object& OpenAndRepair, Object& DocumentDirection, Object&
    NoEncodingDialog, Object& XMLTransform)
     
    AJ, Dec 9, 2009
    #1
    1. Advertisements

  2. AJ

    Guest

    Re: Attempted to read or write protected memory while open a Word Document

    I get the same exception. Did you manage to find the problem?


    On Wednesday, December 9, 2009 7:28:54 AM UTC+2, AJ wrote:
    > Hi ..I have a WinXP SP2 machine on which Office 2007 SP2 is
    > installed.Things worked fine when office SP1 was installed.Since the
    > time SP2 has been insatlled,I get the Below Exceptions when trying to
    > open a WordDocument(.docx)
    > Below are my lines of code
    > Word.Document doc;
    > object wordTrue = (object)true;
    > object wordFalse = (object)false;
    > object missing = System.Reflection.Missing.Value;
    > object fileToOpen = targetDocxDoc;
    >
    > doc = Globals.ThisAddIn.Application.Documents.Open(
    > ref fileToOpen,
    > ref missing, ref wordFalse, ref wordFalse, ref
    > missing,
    > ref missing, ref missing, ref missing, ref missing,
    > ref missing, ref missing, ref missing, ref missing,
    > ref missing, ref missing, ref missing);
    >
    > The line Documents.Open gives teh following Exception Deatls ---
    >
    > System.AccessViolationException occurred
    > Message="Attempted to read or write protected memory. This is often
    > an indication that other memory is corrupt."
    > Source="Microsoft.Office.Interop.Word"
    > StackTrace:
    > at Microsoft.Office.Interop.Word.Documents.Open(Object&
    > FileName, Object& ConfirmConversions, Object& ReadOnly, Object&
    > AddToRecentFiles, Object& PasswordDocument, Object& PasswordTemplate,
    > Object& Revert, Object& WritePasswordDocument, Object&
    > WritePasswordTemplate, Object& Format, Object& Encoding, Object&
    > Visible, Object& OpenAndRepair, Object& DocumentDirection, Object&
    > NoEncodingDialog, Object& XMLTransform)
     
    , Sep 19, 2012
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MM

    how to write in a table in a footer ?

    MM, Jul 11, 2003, in forum: Word Programming
    Replies:
    3
    Views:
    92
  2. Harold

    spell check protected forms

    Harold, Sep 29, 2003, in forum: Word Programming
    Replies:
    0
    Views:
    136
    Harold
    Sep 29, 2003
  3. Timothy Golden

    field codes memory leak

    Timothy Golden, Dec 11, 2003, in forum: Word Programming
    Replies:
    0
    Views:
    127
    Timothy Golden
    Dec 11, 2003
  4. geek@work

    write to fields in template using C#

    geek@work, Dec 15, 2003, in forum: Word Programming
    Replies:
    1
    Views:
    121
    Harold
    Jan 5, 2004
  5. hlam
    Replies:
    0
    Views:
    120
  6. christophercbrewster via OfficeKB.com

    Multi-file find: select files; open read-only (NEED HELP)

    christophercbrewster via OfficeKB.com, Oct 3, 2006, in forum: Word Programming
    Replies:
    3
    Views:
    119
    Cindy M.
    Oct 6, 2006
  7. oksi
    Replies:
    0
    Views:
    233
  8. MIS Dude
    Replies:
    0
    Views:
    104
    MIS Dude
    Jan 22, 2009
Loading...