Hello all,

I wonder if anyone can take a peep at this code and suggest where I might be going wrong..

Public Function CheckIP(a, b, c, d As String) As Boolean

'declare variable to hold ip
Dim ip_addr
'build ip_addr
ip_addr = a & "." & b & "." & c & "." & d

'declare status var
Dim pingOk

'call ping application
pingOk = ShellExecute(vbNullString, vbNullString, "ping.exe", ip_addr, vbNullString, vbNormalFocus)

'returns true if ping has worked
CheckIP = True

End Function

The error I get is type mismatch on:

pingOk = ShellExecute(vbNullString, vbNullString, "ping.exe", ip_addr, vbNullString, vbNormalFocus)

I’m not quite sure this is the right syntax, as I am coming more from the c/c++ side of things with regards to shellexecute.

Also does anyone know of a way to catch the output of ping.exe in the program, without having to echo ping.exe to a text file?

Thanks,
nick