View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Corey Corey is offline
external usenet poster
 
Posts: 19
Default Hide Command Shell window

Hi Folks,

I'm trying to use the following VBA code to verify a list of server's DNS
record. Although the results are correct, the command shell window always
appears. Is any way to completely hide it? TIA.

Corey

Code:

Function MyNslookupExe(ByRef fstrFQDN As String, ByRef fstrRealIP As String,
fstrCmd As String)

' The function is to receive nslookup result.

Dim WSH, wExec
Dim Result As String
Dim tmp

fstrFQDN = ""
fstrRealIP = ""

Set WSH = CreateObject("WScript.Shell")
Set wExec = WSH.Exec(fstrCmd)

Result = wExec.StdOut.ReadAll

tmp = Split(Result, vbCrLf)

If tmp(3) < "" And Left(tmp(3), 4) = strName Then

fstrFQDN = LCase(Trim(Right(tmp(3), Len(tmp(3)) - Len(strName) - 1)))
fstrRealIP = LCase(Trim(Right(tmp(4), Len(tmp(4)) - Len(strAddress)
- 1)))

End If

Set wExec = Nothing
Set WSH = Nothing

End Function