473,321 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Getting an error when the Word add-in is run

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:
Expand|Select|Wrap|Line Numbers
  1. private void ThisAddIn_Startup(object sender, System.EventArgs e)
  2.     {
  3.         ConsoleKeyInfo info = Console.ReadKey();
  4.         if (info.KeyChar == ' ')
  5.         {
  6.             Word.Range rng = this.Application.ActiveDocument.Words.Last;
  7.             rng.Select();
  8.             rng.Copy();
  9.             String input = Clipboard.GetText(TextDataFormat.Text);
  10.         }
  11.     }
I'm getting the following error:
An exception of type 'System.InvalidOperationException' occurred in mscorlib.dll but was not handled in user code.
For the following line:
Expand|Select|Wrap|Line Numbers
  1. ConsoleKeyInfo info = Console.ReadKey();
Oct 19 '14 #1
1 1258
Frinavale
9,735 Expert Mod 8TB
What type of application are you implementing?
Oct 20 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Imran | last post by:
I m getting this error when i open asp.net Form Design View. "The file failed to load in the Web Form Designer. PLease Correct the following error, then load it again. The designer could not be...
1
by: dipesh | last post by:
I am getting error when trying to Add Web Reference in Visual Studio 2005. "Some of the files required for web references are not installed"
1
by: siddu | last post by:
Hi All, I have to do one task. First i need to copy files from vss and run bat files.i have a document with all steps. step 1: we have to take files from vss by using getlatestversion...
1
by: PulkitZery | last post by:
Hi, I am getting the following error when calling a method which i defined in web service. Any Idea?...
2
by: mak1084 | last post by:
i friends i'm getting this error when i execute the insert query.... what is the problem and how i can execute the my query? :?
1
by: jonny | last post by:
Went from using Visual Web Develop express to Visual Studio 2005 and getting error when trying to open project. Error message: "One or more projects in the solution could not be loaded for the...
0
by: =?Utf-8?B?UmF2aQ==?= | last post by:
Hi, I have WCF service and integrated with STS (WS-Federation). The Service exposes 5 endpoints Win, UNT and Federated Windows, Federated UNT and Mex endpoint. My STS Service exposes 3 endpoints...
4
by: sumit kale | last post by:
Hi, Can somebody help me resolve my problem ? I am getting error when calculating total using unbound textfiled in subform. I have a main form called purchase_register_master and a subform...
1
by: NareshN | last post by:
Hi, I am getting error in following stored procedure in where condition Must declare the scalar variable "@CampaignId".I already declared CampaignId but still getting error.Please see where...
1
by: pallabtrue | last post by:
hello bytes friends, I am trying to run simple perl script with linux command where I am using 'awk' command and my perl script is ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.