Attempted to read or write protected memory while open a WordDocument

A

AJ

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)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top