Results 1 to 5 of 5

Thread: Sendkey "^c" cannot copy to clipboard

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513

    Sendkey "^c" cannot copy to clipboard

    I am using VBA in my xls spreadsheet. I opening a third party app using the shell command. The app opens and I use sendkeys to tab 3 times on the app. This works great... the problem is when I try to send sendkeys "^c" the field which is highlighted on the app is not being copied using the sendkeys "^c".... any ideas what is wrong? Again I am able to send tab 3 times to the app... the problem is the highlited contents on the app is not being copied to the clipboard...

    help help

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Sendkey "^c" cannot copy to clipboard

    Try
    VB Code:
    1. SendKeys "^c", True
    The problem could be that sendkeys is unreliable and depends upon the other app having the focus.
    Try slowing it down so the commands dont execute one right after another.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513

    Re: Sendkey "^c" cannot copy to clipboard

    I tried that... but it seems the app looses focus... how can i set the focus on the app before doing a copy?

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Sendkey "^c" cannot copy to clipboard

    You will need to use some API calls. If you do not have the API VIewer and API Guide then I suggest you download them from allapi.net.

    Here is one of their tips which activates another programs main window.

    http://www.mentalis.org/tips/tip006.shtml
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Sendkey "^c" cannot copy to clipboard

    are you useing a separate sendkeys statement to send the ^C?
    try sending it in the same string as the tabs.

    also if the other app has a menu, you could try sending alt e c

    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width