In the context of an Outlook add-on using the WordEditor from the Outlook.Inspector I would like to remove the selection after replacing it with a custom text.
For example, if I select something I can change the selection to a custom text as follows:
Word.Selection sel = doc.Windows[1].Selection;
Word.Range range = sel.Range;
if(sel.Text.Length == 0) {
MessageBox.Show("No Text is selected");
return;
}
sel.Text = "New Text";
sel.Collapse();
If I call this function again, now sel.Text.Length is equal to 1 instead of 0.