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

Discussion in 'ASP .Net' started by apondu, Jul 19, 2007.

  1. apondu

    apondu Guest

    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.wdKeyCategoryCommand,"DoSomeThing",app.BuildKeyCode(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

    Thanks for the help

    Regards,
    Govardhan
     
    apondu, Jul 19, 2007
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Danny

    Implement Ctrl-C, Ctrl-V

    Danny, Aug 14, 2003, in forum: C++
    Replies:
    5
    Views:
    875
    CBFalconer
    Aug 15, 2003
  2. Danny

    Implement Ctrl-C, Ctrl-V

    Danny, Aug 14, 2003, in forum: C Programming
    Replies:
    5
    Views:
    868
    CBFalconer
    Aug 15, 2003
  3. Angus
    Replies:
    5
    Views:
    2,851
    Michael Rauscher
    Nov 18, 2006
  4. Replies:
    2
    Views:
    1,628
    Munna
    Jul 10, 2008
  5. Replies:
    0
    Views:
    726
  6. bryan
    Replies:
    1
    Views:
    405
    bryan
    Jan 30, 2009
  7. joy99
    Replies:
    6
    Views:
    477
    Vlastimil Brom
    Nov 28, 2009
  8. Michael G. Schneider

    Modifying a Word document without using Word Automation

    Michael G. Schneider, Dec 15, 2003, in forum: ASP General
    Replies:
    5
    Views:
    539
    el.c. - myLittleTools.net
    Dec 16, 2003
Loading...