Hi All,

I have a complex report which is generated through word automation. I use Visual Studio 2005, Word 2003 DLL's and i do the programming in C#.

I perform a sequence of operations and track every operation with a log. And the application was working fine on almost all the client machines but one machine threw an exception which was caught in the Logger.

{Interop.Word} : Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Word.Selection.ClearFormatting()

This sequence comes after I insert a table at one point of time and use the ClearFormatting() method to clear the contents Formatting. But the irony is that during development, i had this exception thrown when i was inserting 2 Logo's in the page header. Somehow the issue was not recurring later on. In some other post where the users were getting some similar exception, suggestion was given to change the Tool-->Security-->Macro settings. It was not of any help here.

Is this issue is due to some other reason or is it because of the code. The DLL's too gets installed on the Clients machine along with the application.

Re: Visual Studio Tools for Office Error In Automation: "Attempted to read or write protected memory...."

Douglas H. Troy

This forum is specific to development issues/questions pertaining to VSTO technologies. You'll need to repost your question in one of the following groups:


Just an FYI - without tracking down the line(s) of code that are throwing your exception, you're not going to get an answer. What you've posted is too vague...