title: Word Cannot Edit Range
body: <p>I'm trying to automate the editing of a form and I've run into an issue with the bookmarks. The way I'm doing the forms is filling one out, saving it, redoing all the fields and saving it again. This saves time saving, opening and closing lots of different files and means I don't have to iterate through bookmarks and formfields each time.</p>
  
  <p>However it would appear that when a bookmark has text inserted into it using wordApp.Selection.TypeText() the bookmark is destroyed or lost. Whatever the case I can no longer get hold of it. At the moment I have been getting the range and placing a new bookmark at the location after I put text into the old one.</p>
  
  <p>Unfortunately this leaves the previous text behind when I try to replace it because I'm not overwriting the text in the old bookmark. Such as:</p>
  
  <pre><code>Form 0:
  
  Name: John Smith
  
  Form 1:
  
  Name: Jane DoeJohn Smith
  </code></pre>
  
  <p>I've been trying to select the previous text and delete it but I'm being blocked by two similar errors, "Cannot Edit Range" and "Range cannot be deleted". I'm attempting it with:</p>
  
  <pre><code>//Exception - CANNOT EDIT RANGE
  Range range = doc.Bookmarks[fieldName].Range.Duplicate;
  doc.Range(range.Start, range.End).Delete();
  </code></pre>
  
  <p>I've also tried <code>range.text = ""</code> but I get the same result or "Range Cannot be Deleted".</p>
  
  <p>It's a bit messy but I've tried many different variations of ranges trying to get the text but it always boils down to it not letting me change the text I've entered.</p>
  
  <p>I looked at the similar question to this:</p>
  
  <p><a href="https://stackoverflow.com/questions/4962712/the-range-cannot-be-deleted-at-microsoft-office-interop-word-range-set-textstr">The range cannot be deleted. at Microsoft.Office.Interop.Word.Range.set_Text(String prop)</a></p>
  
  <p>But the answer there thus far has not been able to resolve my issue.</p>