Pass keys ctrl-c/ctrl-x/ctrl-v from Access to ActiveX RRS feed

  • Question

  • Hi!

    I'm looking for a way to grab copy-cut-paste key and send it directly to my ActiveX control, wich is in an Access form.


    Thursday, September 26, 2019 2:29 PM

All replies

  • What does "my ActiveX" control mean? You have written an ActiveX control and can modify it? Then add a CopyFromClipboard method.

    Otherwise you may use Win32 SendMessage, if the ActiveX has an window handle.

    And last but not least, you may use Win32 Clipboard access to read the content in VBA and assign it to a property of your ActiveX control.

    And maybe there is a different solution: What is your problem, your actual use-case?

    Thursday, September 26, 2019 2:36 PM
  • Try:

    Select the form field  or text to copy

    Application.CommandBars.ExecuteMso ("Copy")

    Select the form field to paste

    Application.CommandBars.ExecuteMso ("Paste")


    DoCmd.RunCommand acCmdCopy

    DoCmd.RunCommand acCmdPaste

    might also work

    Thursday, September 26, 2019 3:03 PM
  • Ok, so sorry, it was clear in my head...

    Thanks for you rapid answer.

    I created a userControl in Visual Studio(C#).

    I inserted it in Access, in a form.

    When I run my userControl in a Windows form(Visual Studio), ctrl-c, etc works fine, for all fields(events are trapped by each field).

    When I ran it in Access, there was no access to the context menu when I clicked in fields. I created one with copy/cut/paste options in my userControl and use Clipboard to get/set the selection. It works fine...

    But when I click ctrl-c/ctrl-v in any control of my userControl, nothing happend. I have read that keys are trapped by Access form.

    I would like to know if there is a way to prevent keys to be trapped by Access...

    I hope you'll understand my problem now...

    • Edited by Mariquiqui Thursday, September 26, 2019 3:26 PM
    Thursday, September 26, 2019 3:24 PM