Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 762965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:29:00+00:00 2026-05-14T16:29:00+00:00

I get the following exception when I try to find and replace in a

  • 0

I get the following exception when I try to “find and replace” in a Word 2007 working on Windows Vista or Windows 7.

System.AccessViolationException:
Attempted to read or write protected
memory. This is often an indication
that other memory is corrupt. at
Microsoft.Office.Interop.Word.Find.Execute(Object&
FindText, Object& MatchCase, Object&
MatchWholeWord, Object&
MatchWildcards, Object&
MatchSoundsLike, Object&
MatchAllWordForms, Object& Forward,
Object& Wrap, Object& Format, Object&
ReplaceWith, Object& Replace, Object&
MatchKashida, Object& MatchDiacritics,
Object& MatchAlefHamza, Object&
MatchControl)

Is there any solution for this ?

Iam using .NET3.5 C#.

**********CODE****************

public static Application Open(string fileName)
{
    object fileNameAsObject = (object)fileName;
    Application wordApplication;            
    wordApplication = new Application();
    object readnly = false;
    object missing = System.Reflection.Missing.Value;
    wordApplication.Documents.Open(
        ref fileNameAsObject, ref missing, ref readnly, 
        ref missing,ref missing, ref missing, ref missing, 
        ref missing,ref missing, ref missing, ref missing, 
        ref missing,ref missing, ref missing, ref missing, 
        ref missing
    );

    return wordApplication;             
}

private static void ReplaceObject(
    ref Application wordApplication, 
    object ObjectTobeReplaced, object NewObject)
{
    // ++++++++Find Replace options Starts++++++

object findtext = ObjectTobeReplaced;
    object findreplacement = NewObject;
    object findforward = true;
    object findformat = false;
    object findwrap = WdFindWrap.wdFindContinue;
    object findmatchcase = false;
    object findmatchwholeword = false;
    object findmatchwildcards = false;
    object findmatchsoundslike = false;
    object findmatchallwordforms = false;
    object replace = 2; //find = 1; replace = 2
    object nevim = false;
    Range range = wordApplication.ActiveDocument.Content;
    range.Find.Execute(
        ref findtext, ref findmatchcase, ref findmatchwholeword, 
        ref findmatchwildcards,ref findmatchsoundslike, 
        ref findmatchallwordforms, ref findforward, ref findwrap,
        ref findformat, ref findreplacement, ref replace, 
        ref nevim, ref nevim, ref nevim, ref nevim
        );
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T16:29:01+00:00Added an answer on May 14, 2026 at 4:29 pm

    Issue was fixed after reinstalling Office :)… But still dont know what caused the issue

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following exception java.lang.NumberFormatException: Invalid int: It is happening when you try
I get the following exception when navigating to a page in my windows phone
I get the following error: Unhandled Exception: System.IO.IOException: The parameter is incorrect. at System.IO.__Error.WinIOError(Int32
when i run my application, i get following exception. I have no problem with
I get the following exception when i launch my application through JWS.But it works
I get the following exception when trying to access any nodes of a parsed
I get the following Exception running my app: java.net.SocketException: Permission denied (maybe missing INTERNET
I get the following error when I run a java program: Exception in thread
For the attached code, I get the following compile time error : exception during
I get an exception while executing following piece of code bool FieldValueMessage::Get(const std::string &field,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.