473,382 Members | 1,258 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,382 software developers and data experts.

Supressing the ctrl-c and other keys during word automation in automation

Hi,

can someone help me and provide me the information on how to supress
the
default action of the shortcut keys of word during word automation.

I am using C#.Net

I have written a code but it generates a exception "Object Reference
not set
to an instance of a object".

I have posted my code here, can someone take a look at it and help in
understand and help me to get the solution for this

Word._Application app = null;

object c = Word.WdKey.wdKeyC;

object ctrl = Word.WdKey.wdKeyControl;

object mykey = null;

word.KeyBindings.ClearAll();

mykey =
word.KeyBindings.Add(Word.WdKeyCategory.wdKeyCateg oryCommand,"DoSomeThing",app.BuildKeyCode(Word.WdK ey.wdKeyControl,
ref c, ref missing, ref missing),ref missing,ref missing);

Here DoSomething is a dummy function

public void DoSomeThing()
{
}

It would be great if someone could help me.

My mail id is ap****@gmail.com

Thanks for the help

Regards,
Govardhan

Jul 19 '07 #1
1 1958
Apondu,

This is a VB.NET newsgroup

Ask the question here:

microsoft.public.dotnet.languages.csharp

For the Control + C combination you can do this a few ways:

1) Blank Context Menu
2) WndProc

But you want it via MS Word

Youneed to declare a NEW object for MS Word

I always declare Keys as Integers

No-one will e-mail you directly because of the spam aspect & for that reason I
suggest you spoof your e-mail

--
Newbie Coder
(It's just a name)

--
Newbie Coder
(It's just a name)
"apondu" <ap****@gmail.comwrote in message
news:11*********************@i13g2000prf.googlegro ups.com...
Hi,

can someone help me and provide me the information on how to supress
the
default action of the shortcut keys of word during word automation.

I am using C#.Net

I have written a code but it generates a exception "Object Reference
not set
to an instance of a object".

I have posted my code here, can someone take a look at it and help in
understand and help me to get the solution for this

Word._Application app = null;

object c = Word.WdKey.wdKeyC;

object ctrl = Word.WdKey.wdKeyControl;

object mykey = null;

word.KeyBindings.ClearAll();

mykey =
word.KeyBindings.Add(Word.WdKeyCategory.wdKeyCateg oryCommand,"DoSomeThing",app.B
uildKeyCode(Word.WdKey.wdKeyControl,
ref c, ref missing, ref missing),ref missing,ref missing);

Here DoSomething is a dummy function

public void DoSomeThing()
{
}

It would be great if someone could help me.

My mail id is ap****@gmail.com

Thanks for the help

Regards,
Govardhan

Jul 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jp Calderone | last post by:
When using PyChecker on a project which uses bsddb, dozens of messages like the following are reported: warning: couldn't find real module for class bsddb._db.DBAccessError (module name:...
4
by: Scott | last post by:
I am using a TCPIP connection to communicate over port 23 (telnet) to a server, and I am having to mimic normal command line interface you owuld see in a telnet session (i.e. I have to write to...
13
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to...
5
by: Greg | last post by:
I am developing an application where I need to secure a workstation for periods of time. I can use BlockInput to stop users from task switching or messing with the keyboard, but I would like to...
6
by: Paul Gorodyansky | last post by:
Hi, Question about event.altKey event.ctrlKey event.shiftKey If I need to catch when a user does say Ctrl+Alt+G - somehow event.altKey is not working, i.e.:
12
by: Wurm | last post by:
Hi all, Got a little problem with a lib that I'm working on. First of all, the problem is that the lib that I have makes connections to DirectSound, and has a host of custom built sound related...
11
by: Michael B Allen | last post by:
Is there a standard method for supressing warnings regarding unused parameters? I have a function that might be called hundreds of thousands of times that looks like this: const void *...
3
by: Stefan | last post by:
Hy, i have an app and i must disable this combination: ALT+F4; CTRL+ALT+DEL; CTRL+ESC;ALT+TAB like this: i find something on Internet and i can block ALT+F4 protected override...
3
by: Glen Hong | last post by:
I have set up a hotkey using RegisterHotKey API function for Ctrl-Tab. Firstly, I can rap this when Ctrl-Tab is pressed however if I want to add an addition hotkey how can I distinguish between...
2
by: crjunk | last post by:
I'm trying to write a piece of code that will programatically save a record automatically without me having to add a new ' Row.Item("ADD1") = txtAdd1.Text.Trim.ToUpper ' type command each time I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.