Firstly thank you for your reply ...:)
I compiled the code and I get two errors in the lines you have mentioned. I missing some parameter or do not I put where it should be?
This is the complete code;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Word = Microsoft.Office.Interop.Word;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Word;
using Microsoft.Office.Tools.Word.Extensions;
namespace WordAddIn1
{
public partial class ThisAddIn
{
private void Rango()
{
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
string document = null;
using (OpenFileDialog dia = new OpenFileDialog())
{
dia.Filter = "MS Word (*.docx)|*.docx";
if (dia.ShowDialog() == DialogResult.OK)
{
document = dia.FileName;
}
}
if (document != null)
{
***Document doc = word.Documents.Open(document, ReadOnly: false, Visible: true);***
doc.Activate();
string text = doc.Content.Text;
int start = text.IndexOf('E') + 1;
int end = text.IndexOf('F');
if (start >= 0 && end >= 0 && end > start)
{
***Range range = doc.Range(Start: start, End: end);***
range.Select();
}
}
}
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Rango();
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
}