473,671 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting an error when the Word add-in is run

1 New Member
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.Invalid OperationExcept ion' 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 1285
Frinavale
9,735 Recognized Expert Moderator Expert
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
1738
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 shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: form1.aspx -- the designer for the base class ' System.Web.UI.Page' is not installed."
1
2413
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
1927
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 option and copy it to some where in local. step2: In Dos command prompt i have to run 2 .bat files
1
1233
by: PulkitZery | last post by:
Hi, I am getting the following error when calling a method which i defined in web service. Any Idea? ---------------------------------------------------------------------------------------------------------------- System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://tempuri.org/MinuteTraqService/Data_1_0/MailMsg. at...
2
1524
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
2504
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 following reason(s): The project file or web has been moved, renamed or is not on your computer.
0
621
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 WIN, UNT and Mex. I am getting error when I sent a request from a client to WCF Service Fed-Win/ Fed-Unt endpoints. But it is passing for the regular Win and Unt endpoints.
4
4016
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 called purchase_register_details, In sub form i have a unbound textfield called txt_Total_Amount where in i am calculating total amount for different items purchased by giving following code in control source. ContolSource: =Sum() In my main form i...
1
1545
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 condition which is in bold letters. If i give value its working like where CampaignID=1 alter PROCEDURE SAR_Sp_GetForecastedHC(@date1 DATETIME, @date2 DATETIME, @date3 DATETIME, @date4 DATETIME,@CampaignId int) AS DECLARE @query VARCHAR(MAX)
1
1572
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 ------------------------------------------------ #!/usr/bin/perl -w use strict; while (my $line =<>) { chomp $line;
0
8390
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8911
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8597
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5692
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4402
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2808
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.