LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default SendKeys with DOS program

Nope, that still didn't work ;-(

I've now changed my approach......

I create the input files for the DOS program from within EXCEL using VBA.
I then quit EXCEL, and use a script written in VB Script running on the
Windows Script Host, to send the name of each file to the DOS program in
turn. Setting the delay to 1600ms prior to sending the keys seems to
work...so I'll stick with this solution chaps and chappesses.

Cheers for your suggestions.
--
Cheers,

Paul.


"evildad" wrote:

Thanks for that Rib, it looks promising........
Cheers,

Paul.


"Robert Bruce" wrote:

evildad wrote:
Hi all,

Please help as I'm going INSANE.......................................

I have written a VBA macro in Excel, which attempts to do the
following:
1. Loop through spreadsheets in a directory
- Create a text input file from data held in spreadsheet.
- Open a DOS program with the SHELL command
- Send name of this input file to the DOS program
- Retrieve data from the output file, and paste into spreadsheet
- Save and close spreadsheet, open next spreadsheet in directory.


Sendkeys is nasty and dirty. However, if you really must use it in your
situation you should avoid trying to send keystrokes to the dos session.
Sendkeys is designed to send keystrokes to a Window and the dos session
running inside a dos window isn't really a, er, Windows window. What you
*can* do is to place your keystrokes into a string variable, put that string
onto the clipboard and then send keystrokes to the window that wraps the dos
session to paste the string - Alt+Spacebar then E then P

I've had this work well in the past, but you may need to put some delays in
to ensure that everything is waiting ready for keystrokes to be sent.

HTH

Rob



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendkeys Jim Excel Programming 1 April 16th 05 06:44 PM
Inter-program communication using SendKeys Tim Coddington Excel Programming 3 October 7th 04 04:00 AM
SendKeys command not focusing on the correct open program mjwillyone[_12_] Excel Programming 0 December 30th 03 04:06 AM
merging excel program with tdc finance program judy Excel Programming 0 November 5th 03 08:01 PM
SendKeys Ron de Bruin Excel Programming 3 August 25th 03 10:21 PM


All times are GMT +1. The time now is 04:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"