LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Reliable send keys

Hello

I use the code below to open and run ipconfig /all to file. It woks fine on
my laptop but is hit-and-miss on other laptops, sometimes running; sometimes
producing Enter only; sometimes nothing more than the open cmd window. Is
there a way to ensure the code does its job? I was thinking of While Dir
produces nothing and shortening the wait time but the thought of the
SendKeys disappearing into buffers or elsewhere worries me - running the
code in break mode experience :-) Is there another way?


Sub RunCMD()
Dim ReturnValue

sCmd = "ipconfig /all " & ActiveWorkbook.Path & "\" & fName & " {ENTER}"

ReturnValue = Shell("CMD.EXE", 1)

' possibly, While the file doesn't exist
Application.OnTime Now + TimeSerial(0, 0, 5), "typeKeys" ' reduce 5 to 1?
'Wend
End Sub



Private Sub typeKeys()
SendKeys sCmd
End Sub


--
Steve

 
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
need help using send keys funkymonkUK[_184_] Excel Programming 1 June 16th 06 01:41 PM
SEND KEYS?????? Please.... help... nisgore Excel Programming 1 October 20th 05 11:59 AM
Send Keys Sgwapt Excel Programming 1 August 7th 05 02:03 AM
send keys ksnapp[_52_] Excel Programming 2 April 9th 04 06:41 AM
Send Keys [email protected] Excel Programming 0 August 21st 03 08:13 PM


All times are GMT +1. The time now is 07:19 PM.

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"