title: How to get the range of a specific word in Word Document using Word Interop
body: <p>I am creating a C# program that inserts a table inside a word document. Now, I need to insert a table in a certain position in different word documents. All word documents/templates I have has the word <code>&lt;table&gt;</code> in it where I want to insert the table. For me to be able to insert the table in that particular word document position, I need to get the range of the location of the word <code>&lt;table&gt;</code>. Is there any possible way to get the range of that particular word inside the word document?</p>
  
  <p>All I can see in the references I have searched are getting ranges using the count of a space, word, sentence, etc. such as the following:</p>
  
  <pre><code>object start = doc.Words[2].Start; //start of the second word
  object end = doc.Words[2].End; // start of the third word
  
  Word.Range myRange = doc.Range(ref start, ref end);
  </code></pre>
  
  <p>Since the number of words inside my word document is dynamic, the code above is not very helpful.</p>
  
  <p>Is there any way to get the range of a specific word inside a word document using C# word interop?</p>