Good Day To All,
Below is a copy of a Sub to check whether connected or not to the network.
This is ok, only I need to hide the command window during execution or to work in the background only.
Private Sub btnEXIT_Click()
Dim stdOut, objScriptExec, strPingResults
Set objShell = CreateObject("WScript.Shell")
On Error Resume Next
Set objScriptExec = objShell.Exec("ping -n 2 -w 500 " & "192.168.100.7")
strPingResults = LCase(objScriptExec.stdOut.ReadAll)
Set stdOut = Nothing
Set objScriptExec = Nothing
If InStr(strPingResults, "reply from") Then
MsgBox "ConnectionOK"
Else
MsgBox "Connection NOK"
End If
End Sub
I'd tried inserting (,0)
" Set objScriptExec = objShell.Exec("ping -n 2 -w 500 " & "192.168.100.7", 0)"
yes, it's gone but always "Connection NOK".
Any help/tips will be highly appreciated.
As usual, advance thanks to all for the continued support to the novice like me.
More power guys...
Joey
Below is a copy of a Sub to check whether connected or not to the network.
This is ok, only I need to hide the command window during execution or to work in the background only.
Private Sub btnEXIT_Click()
Dim stdOut, objScriptExec, strPingResults
Set objShell = CreateObject("WScript.Shell")
On Error Resume Next
Set objScriptExec = objShell.Exec("ping -n 2 -w 500 " & "192.168.100.7")
strPingResults = LCase(objScriptExec.stdOut.ReadAll)
Set stdOut = Nothing
Set objScriptExec = Nothing
If InStr(strPingResults, "reply from") Then
MsgBox "ConnectionOK"
Else
MsgBox "Connection NOK"
End If
End Sub
I'd tried inserting (,0)
" Set objScriptExec = objShell.Exec("ping -n 2 -w 500 " & "192.168.100.7", 0)"
yes, it's gone but always "Connection NOK".
Any help/tips will be highly appreciated.
As usual, advance thanks to all for the continued support to the novice like me.
More power guys...
Joey