Pass keystrokes to another program?

acollins

Board Regular
Joined
Aug 1, 2007
Messages
63
Is it possible to write a VBA macro that passes keystrokes to another program? I have a spreadsheet with over 650 UPC codes for new products that have to be entered into our inventory system. I have downloaded and tried a few macro recorders that record keystrokes and mouse movements, but find them to be unreliable at best.

When I use the macro recorder to automate a task in Excel, (such as moving data from one sheet to another or importing data from a text file) I always go in after I'm done recording and add additional code to bullet-proof the macro (make sure the focus is set properly, etc.). I need to have this kind of control for this task and a macro recorder doesn't give me that (at least not these lower-end shareware programs I have been trying). I know that there are some higher-end macro recorders that include scripting that you can write and edit, but this our "slow" season business-wise and my supervisor has made it clear that he doesn't want to spend any money right now.

My task is simple (just very repetitive, which is why I don't want to spend all day sitting in front of my PC doing this):
1. Open Excel spreadsheet, go to starting data cell
2. Open 3rd party application and go to the appropriate data entry screen
3. Write a macro that does the following:
- checks to make sure the sheet is the active sheet
- copies contents of the active cell
- moves focus to other app and pastes data from active cell
- moves focus back to spreadsheet, copies the contents of the cell to the right (using ActiveCell.Offset?)
- makes other app active and pastes data
- repeat copy/paste for the next cell to right (in spreadsheet)
- press <ESC> twice to save record before returning focus to the spreadsheet
- move cursor down one line, repeat entire process until active cell is blank

Is this possible to do? The third party program is not able to listed as a reference in VBA, but I didn't know if it was possible to at least pass keystrokes to it. It is actually a terminal emulator (Anzio Lite). I guess the full-blown version of the program has some scripting capabilities (from the documentation I've read), but the Lite version does not.

Thanks,

Alan
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
To acollins original post:

Did you resolve your issue with sneding data to the 2nd app?

I've done extensive work with terminal emulators with and w/o VBA loaded and automating screen flows/data input. The key is knowing what the expected key entry flow is in your term emul and replicating those keystrokes in Excel.

Let me know if you still are having issues.
 
Upvote 0
back to this....Excel is not meant for other applications ...but it is all connected if you are running Windows:)

there is special software that program testers use...but something simpler maybe MacroExpress?
 
Upvote 0
hi

i know this is an old thread, but im hoping you can help me. We use a program called Reflections for Regis graphics made by a company called Attachmate.
I guess this is what you call a terminal emulator? i have some VBA code that im using to enter a password on a pop up window from this program.
When i step through the code with F8, i can see the password being entered and the OK button pressed.

However, when i run the program at full speed :) ( F5) the execution stops at the point where the password popup window has the cursor blinking inside it
waiting for input. ive tried various lines of code to try and include delays but not had any luck :(. i have posted this at excelforum but have had no responses.

Can anyone here help please? this is a time critical project and im getting desperate.

thanks
 
Upvote 0

Forum statistics

Threads
1,215,790
Messages
6,126,914
Members
449,348
Latest member
Rdeane

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top