I'm using vb.net, and trying to open an existing word file using Microsoft.Office.Interop. My code is as follows:
Dim objWord As Word.Application
Dim objDoc As Word.Document
'Open Word
objWord = New Word.Application
objWord.Visible = True
Try
objDoc = objWord.Documents.Open(Application.StartupPath & "\GOS3_Leo.doc")
Catch ex As Exception
MessageBox.Show("Failed to load GOS3_Leo.doc")
MessageBox.Show(ex.ToString)
Exit Sub
End Try
(with imports Microsoft.Office.Interop outside)
Every time the .Open method fails, and I see this error.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I have found many people on the internet with this error, but no solutions that work for me. I am using Visual Studio Express.
Help would be very much appreciated
-Harriet
Solved. Installed earlier version of Microsoft.Interop from Microsoft website. This silly girl should not be allowed near a computer.