Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Key Strokes

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Seattle Area, WA
    Posts
    217
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I use a company specfic program at work. I always open my Excel workbook that has the figures located in it, and I copy it (ctrl-C) toggle to that window (Alt-Tab) paste it in the system (Ctrl-V) and then Page Down (with the keyboard button) and toggle back to Excel to get the next set of data for pasting. Can I record a macro that will record and preform my actions to run in the other window based system, even if it not excel?

    I have asked & tried, I can not just export the data to the program.

    Please help!!

    Russell

  2. #2
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,239
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Russell,

    No, Excel will not record keystrokes that occur outside of the Excel application process (window). In fact, Excel does not really record keystrokes at all, not even inside Excel. Rather, it records Excel object model operations. And since some Excel operations are not defined in the object model, these operations are not recorded--so you can't necessarily to anything in a macro that you can do manually--at least not the same way.

    In your case, you can probably get an Excel macro to do the appropriate keystrokes for you (using the SendKeys method), but you will have to write the macro yourself. This will only work if you can do everything that needs to be done in your other application via keystrokes. That means that you would have to identify the area that you want to select for cut or copy via keystrokes alone. Most applications are written so that they can be operated from a keyboard only, and if this is the case you are in. But even so, it is sometimes the case that an operation that is trivial to do manually (for example, identifying a certain sentence in a body of text) is daunting to do programmatically.
    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

  3. #3
    Board Regular Bruno's Avatar
    Join Date
    Feb 2002
    Location
    Flanders
    Posts
    484
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You could use some vbs code like this :

    Adjust the 'SENDKEYS' strings to your needs...


    set objShell = WScript.CreateObject("WScript.Shell")

    ' simulate the keys
    objShell.sendkeys "{Enter}{Enter}"

    ' to start another program
    objShell.run "C:MyProgram.exe"

    ' if you have to wait...(time in millisec.)
    WScript.Sleep 3000

    ' other examples
    objShell.sendkeys "%c"
    objShell.sendkeys "Z"




  4. #4
    Board Regular
    Join Date
    Feb 2002
    Posts
    384
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have to do a similar task and I found a great program on the net called Macro Express 3. It will allow you to take data from excel, process it in your company app and do whatever you want to it. It's free for 30 days and then costs around thirty bucks. Here's where they're at.

    http://www.macros.com/

  5. #5
    Board Regular Bruno's Avatar
    Join Date
    Feb 2002
    Location
    Flanders
    Posts
    484
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Another easy solution :
    use the macro recorder of Windows 3.1x

    This little program records keystrokes and mouse movements. I've used every day until I'v learned some vbs code...


Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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