MS Access version 7 -- VBA code:
When I execute the following:
PINGstring = "ping.exe hostname >Ping-Results.txt"
ProgID = Shell(PINGstring, vbNormalFocus)
shell works ok by passing the string to DOS for execution. However, the ping command fails with (as best as I can tell) a message indicating incorrect parameter (the redirection portion of the command).
But, when I execute the exact same command when in the dos prompt window -- the command works perfectly. How do I get this to work within VBA?
Actually, the more general question is: I want to execute ping from VBA in order to see if the specified host is available or not. So I want to somehow capture the output of ping for review in order to make that determination. Seemed like executing ping, redirecting output to a temp file, reading the file, and serching for some keywords (like "unreachable") would easily do the trick. But redirection (>) within the shell() method doesn't seem to work???
thx in advance!!!