I want to copy the word entered by a user as soon as the user presses space(Just like the spell checker in word editors do). I'm using the following code:
I'm getting the following error:
For the following line:
Code:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
ConsoleKeyInfo info = Console.ReadKey();
if (info.KeyChar == ' ')
{
Word.Range rng = this.Application.ActiveDocument.Words.Last;
rng.Select();
rng.Copy();
String input = Clipboard.GetText(TextDataFormat.Text);
}
}
An exception of type 'System.Invalid OperationExcept ion' occurred in mscorlib.dll but was not handled in user code.
For the following line:
Code:
ConsoleKeyInfo info = Console.ReadKey();
Comment